docker常用命令

如何启动已有的docker容器:

1. 查看现有的docker容器

page@page-virtual-machine:~$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS                                        NAMES
e93645a2da09        mysql:latest        "docker-entrypoint.s…"   13 minutes ago      Exited (255) 7 minutes ago   33060/tcp, 0.0.0.0:3308->3306/tcp            mysqldb1
b62fec5b6bd2        mysql:latest        "docker-entrypoint.s…"   15 minutes ago      Created                                                                   mysqldb
db95e22bbd90        spring-nacos        "java -Djava.securit…"   24 months ago       Exited (143) 24 months ago                                                beautiful_jennings
dcd6a1d9c50d        spring-nacos        "java -Djava.securit…"   24 months ago       Exited (143) 24 months ago                                                spring-nacos
5cd9f8a7d43f        spring-nacos        "java -Djava.securit…"   24 months ago       Exited (130) 24 months ago                                                wonderful_shaw
786f2270e995        hello-world         "/hello"                 24 months ago       Exited (0) 24 months ago                                                  focused_galois

2. 启动名称为mysqldb1的容器,参数为其CONTAINER_ID

page@page-virtual-machine:~$ sudo docker start e93645a2da09
e93645a2da09

 

停止容器,docker stop 容器id

page@page-virtual-machine:~$ sudo docker stop e93645a2da09
e93645a2da09

 

删除容器,docker rm 容器id

page@page-virtual-machine:~$ sudo docker rm b62fec5b6bd2
b62fec5b6bd2

 

文件上传 docker cp 本地路径文件 ID全称:容器路径

 

文件下载 docker cp ID全称:容器文件路径 本地路径

上一篇:jar包有嵌套的jar的打包成jar的方法


下一篇:Python3原生编写月份计算工具