需要先安装docker, 可参考《ubuntu安装docker详细步骤》
sudo docker images
sudo docker pull [镜像名]:latest
sudo docker run -itd --name [名称] [镜像名]
sudo docker ps
另外
sudo docker ps -a //查看所有容器
sudo docker run -itd --name [镜像名] -d [镜像名]
sudo docker search [镜像名]
sudo docker exec -it [镜像名] /bin/bash
sudo docker run --name [镜像名] -p 8080:80
sudo docker run --name [镜像名] -v $PWD/test:[容器目录]
sudo docker run --name [镜像名] -w [工作目录]
docker stop [容器id]
或者
docker stop [镜像名]
sudo docker run --name [镜像名] --auth
sudo docker logs [镜像名]
另外
sudo docker logs -f [镜像名] //停留在尾部
sudo docker rm -f [镜像id] [镜像id2] //多个容器以空格隔开
sudo docker restart [镜像id]
sudo docker export [镜像id] > [目标文件]
sudo docker top [镜像名]
sudo docker inspect [镜像名]
sudo docker ps -l
sudo docker tag [镜像名]
which [镜像名]
sudo docker stats
sudo docker rm $(docker ps -aq)
sudo docker pause [镜像名]
sudo docker help [具体指令]
sudo docker network ls
docker network create [网络名]
docker run -dit --name [容器名] --network [网络名] alpine
docker network connect [网络名] [容器名]
docker network rm [网络名]
docker logs -t --since="2019-10-24T13:23:37" --until "2019-10-25T12:23:37" [容器名]
docker logs -t --since="2019-10-24T13:23:37" [容器名]
docker logs --since 30m [容器名]
docker logs --tail=50 [容器名]
docker logs -f -t --since="2019-10-24" --tail=100 CONTAINER_ID
sudo systemctl enable docker
sudo systemctl disable docker
docker version