【DOCKER】基于UBUNTU的开发镜像

1. ubuntu_base

bash 复制代码
########################################################################################################################
# docker build --file ubuntu_base --build-arg UIMG=ubuntu:22.04 --build-arg LOGIN=u22 --tag u22:base .
# docker build --file ubuntu_base --build-arg UIMG=ubuntu:20.04 --build-arg LOGIN=u20 --tag u20:base .
# docker build --file ubuntu_base --build-arg UIMG=ubuntu:18.04 --build-arg LOGIN=u18 --tag u18:base .
# 可选参数
# --no-cache=true --progress=plain
#
# 创建容器并使用默认的root用户登录
# docker run -it --rm --privileged=true --name u20_base u20:base
# 创建容器并使用指定用户登录
# docker run -it --rm --privileged=true --name u20_base --user=u20 --workdir=/home/u20 u20:base
########################################################################################################################
ARG UIMG=
FROM ${UIMG}

ARG LOGIN=
RUN apt-get -y update && apt-get install -y ca-certificates &&\
  cp /etc/apt/sources.list /etc/apt/sources.list.bak &&\
  sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list &&\
  sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list &&\
  apt-get -y update && apt-get -y upgrade &&\
  apt-get install -y net-tools iproute2 iputils-ping &&\
  apt-get install -y wget axel curl &&\
  apt-get install -y zip unzip xz-utils rar unrar &&\
  apt-get install -y gawk sudo vim tree locales lsb-release &&\
  apt-get -y autoremove &&\
  echo 'root:root' | chpasswd root &&\
  useradd -m -s /bin/bash ${LOGIN} && adduser ${LOGIN} sudo && echo "${LOGIN}:${LOGIN}" | chpasswd

2. ubuntu_dev

bash 复制代码
########################################################################################################################
# docker build --file ubuntu_dev --build-arg UIMG=u22:base --tag u22:dev .
# docker build --file ubuntu_dev --build-arg UIMG=u20:base --tag u20:dev .
# docker build --file ubuntu_dev --build-arg UIMG=u18:base --tag u18:dev .
# 可选参数
# --no-cache=true --progress=plain
#
# 创建容器并使用默认的root用户登录
# docker run -it --rm --privileged=true u20:dev
#
# 创建容器并使用指定用户登录
# docker run -it --rm --privileged=true --user=u20 --workdir=/home/u20 u20:dev
#
# Windows
# docker run -id --privileged=true --user=u20 --workdir=/home/u20 --volume D:/dev:/home/u20/dev --name=u20_dev u20:dev
#
# Linux
# docker run -id --privileged=true --user=u20 --workdir=/home/u20 --volume ${HOME}/dev:/home/u20/dev --name=u20_dev u20:dev
########################################################################################################################
ARG UIMG=
FROM ${UIMG}

RUN apt-get -y update &&\
  /bin/bash -c echo -e "\n6\n70\n" | apt-get -y install cmake &&\
  apt-get install -y build-essential gdb git git-lfs autoconf automake libtool pkg-config &&\
  apt-get install -y nasm python3 python3-pip &&\
  echo '[global]' >/etc/pip.conf &&\
  echo 'index-url = https://pypi.tuna.tsinghua.edu.cn/simple' >> /etc/pip.conf &&\
  pip3 install -U pip &&\
  pip3 config --global set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&\
  pip3 config --global set install.trusted-host pypi.tuna.tsinghua.edu.cn &&\
  pip3 install -U pip &&\
  pip3 config --global set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple &&\
  pip3 config --global set install.trusted-host pypi.tuna.tsinghua.edu.cn &&\
  pip3 install meson ninja &&\
  apt-get -y autoremove
相关推荐
嵌入式分享7 分钟前
嵌入式分享#41:RK3576改UART波特率【精简版】
linux·嵌入式硬件·ubuntu·嵌入式
Cyan_RA928 分钟前
Linux 远程Ubuntu服务器本地部署大模型 EmoLLM 中常见的问题及解决方案 万字详解
linux·运维·服务器·ubuntu·大模型·远程部署·emollm
计算机小手2 小时前
推荐一个 GitHub 开源项目信息卡片生成工具,支持Docker快速部署和API调用
经验分享·docker·github·开源软件
饭来_3 小时前
通过 SSH 远程连接 docker 容器
vscode·docker·ssh
1024find4 小时前
Spark on k8s部署
大数据·运维·容器·spark·kubernetes
kura_tsuki4 小时前
[Docker集群] Docker 容器入门
运维·docker·容器
开始学AI5 小时前
【Docker技术】docker-compose.yml与Dockerfile解析
java·docker·eureka
~光~~12 小时前
【环境配置 升级gcc】RK3588 Ubuntu20.04 gcc9升级为gcc10
ubuntu·gcc
你疯了抱抱我15 小时前
【SSH】同一局域网下windows使用Xshell SSH连接另一台 ubuntu 22.04 电脑
运维·ubuntu·ssh
2301_8184115515 小时前
Ubuntu之apt更新源
linux·运维·ubuntu