标签:后台 ash created pre run art 文件 mon 进入容器
ubuntu
容器root@haima-PC:/home/haima/Desktop# docker run -d --name ubuntu-lnmp ubuntu
bf243aabfe110f1aed17a6298c5dbe33df2d023e18fa2f1e1cdb9682d289f710
root@haima-PC:/home/haima/Desktop# docker exec -it ubuntu-lnmp /bin/bash
root@bf243aabfe11:/# cd /home
root@bf243aabfe11:/home# ls
root@bf243aabfe11:/home# mkdir test
root@bf243aabfe11:/home# ls
test
exit
docker ps -a
root@haima-PC:/home/haima/Desktop# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bf243aabfe11 ubuntu "/bin/bash" 5 minutes ago Up 5 minutes ubuntu-lnmp
d4d18c2d2025 centos:v4 "/bin/bash" 2 months ago Up 3 hours centos_env
root@haima-PC:/home/haima/Desktop# docker start ubuntu-lnmp
ubuntu-lnmp
其中“ubuntu-lnmp”是容器的名称。这里会后台运行容器,进入容器再退出后,容器也不会关闭
root@haima-PC:/home/haima/Desktop# docker exec -it ubuntu-lnmp /bin/bash
root@b8cc973c3d4d:/#
输入:
exit
或者按键:
Ctrl + D
启动docker某个image(镜像)的已经关闭的container(容器)
标签:后台 ash created pre run art 文件 mon 进入容器
原文地址:https://www.cnblogs.com/haima/p/12287394.html