Docker 启动与停止

1-docker 指令总结

1.1 docker 安装:

sudo apt-get install curl
sudo curl -sSL https://get.daocloud.io/docker | sh

sudo docker pull ubuntu

sudo docker images
REPOSITORY     TAG           IMAGE ID       CREATED       SIZE
ubuntu         latest        9f4877540c73   4 hours ago   65.6MB

sudo docker run -it ubuntu:latest

sudo docker ps –a
CONTAINER ID   IMAGE          COMMAND   CREATED          STATUS       PORTS     NAMES
14b0103df36c   ubuntu:latest  "bash"    16 minutes ago   Up 11 minutes   my-ubuntu

sudo docker exec –it  my-ubuntu /bin/bash

1.2 docker 导入与导出:

docker 导入与导出
sudo docker save -o ai_docker_img-12-1.tar xxx/server:ubuntu20.04

sudo docker load --input ai_docker_img-12-1.tar
xxx/server   ubuntu20.04

其他备注信息:
run 与start 的区别:
只进行run 一次就可以

$ sudo docker images
REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
hello-world   latest    feb5d9fea6a5   2 months ago   13.3kB
centos        latest    5d0da3dc9764   2 months ago   231MB

sudo docker rmi feb5d9fea6a5

$sudo docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED       STATUS                            PORTS     NAMES
214bc7cd21b7   fefe61075407   "/bin/sh -c 'service…"   3 hours ago   Exited (137) About a minute ago             ai_docker

$sudo docker rename ai_docker docker 
sudo docker rm `sudo docker ps -a -q`

$sudo docker start CONTAINER_name/id 都可以

你可能感兴趣的:(Docker 启动与停止)