Docker¶
- Docker: Securely build, share and run any application, anywhere
- Docker Hub: the world's easiest way to create, manage, and deliver your teams' container applications
- docker中文社区
Overview¶
- the images and containers are stored by Docker in
/var/lib/docker
by default
Image vs Container¶
-
镜像 (Images): 可以认为是超级轻量级的虚拟机的快照。镜像会有自己的唯一ID,名字和标签,比如ubuntu, 比如ubuntu:18.04等。通常都是在已有的镜像(多数是Linux操作系统的镜像)的基础上构建自己的具有新功能的镜像。
-
容器 (Containers): 可以认为是超级轻量级的虚拟机,是镜像运行起来所处的可读写的状态。容器里面可以安装、运行程序,还可以把安装好的程序存储起来获得新的镜像。与虚拟机很大的不同在于,一个容器通常只运行一个程序。在Docker中,应用程序和数据文件是分开的,因此可以在不影响数据的情况下快速升级代码或系统。
Tutorial¶
-
Real-time and video processing object detection using Tensorflow, OpenCV and Docker
-
Running a graphical app in a Docker container, on a remote server
Install¶
Usage¶
Image¶
-
view
-
get
-
create
-
modify
-
delete
-
get
-
run
Bashsudo docker run --help # e.g. sudo docker run hello-world sudo docker run -it <REPO-NAME:TAG> /bin/bash # default TAG: latest sudo docker run -it <REPO-NAME> /bin/bash # e.g. sudo docker run -it ubuntu:15.10 /bin/bash
- -i: 交互式操作
- -t: 终端
- ubuntu:15.10: 这是指用 ubuntu 15.10 版本镜像为基础来启动容器
- /bin/bash:放在镜像名后的是命令,这里我们希望有个交互式 Shell,因此用的是 /bin/bash
Container¶
-
view
-
start & stop container
-
we can also open another terminal for a running container with the following command
or -
commit to update IMAGE
-
history
-
delete
-
copy file
with ROS¶
-
ros-kalibr
Network¶
params
Bash
--net=host
# or
--add-host `hostname`:172.17.0.1 \
--env ROS_MASTER_URI=http://`hostname`:11311/ \
--env ROS_IP=172.17.0.2 \
--hostname happy_go \
--name happy_go \