sudo apt install docker.io
sudo docker pull ubuntu:18.04
FROM ubuntu:18.04
MAINTAINER [user] [email]
RUN apt-get update \
&& apt-get install -y vim \
&& apt-get install -y git \
&& apt-get install -y cmake \
&& apt-get install -y g++ \
&& apt-get install -y python \
&& apt-get install -y python-pip \
&& apt-get install -y pytmote json config: conan rhon3 \
&& pip install conan \
&& cd /home \
&& git clone https://chromium.googlesource.com/chromium/tools/depot_tools \
&& echo "export PATH=/home/depot_tools:$PATH" >> ~/.bashrc \
&& apt-get install -y lsb-core \
&& apt-get install -y sudo \
&& apt-get install -y ssh \
&& mkdir /run/sshd \
&& apt-get install -y openjdk-8-jdk
CMD ["/usr/sbin/sshd", "-D"]
// 在Dockerfile目录执行
// 镜像名:tag, 不指定tag默认latest
sudo docker build -t docker_image_xxx:v1 .
sudo docker run -it docker_image_xxx
sudo docker run -it -v`pwd`:`pwd` docker_image_xxx
运行容器后,可以在容器中安特定工具和命令,再导出容器为镜像供其他人使用。
sudo docker commit 46bb44ef2f08 docker_image_xxx_new
46bb44ef2f08 为容器id
docker_image_xxx_new为新镜像名
sudo docker save docker_image_xxx_new > docker_image_xxx_new.tar
sudo docker load < docker_image_xxx_new.tar