docker命令总结

安装参考菜鸟教程
启动:sudo systemctl start docker

查看正在运行的容器:docker ps
查看所有容器:docker ps -a
停止容器:docker stop container_name
启动停止的容器:docker restart container_name

查看镜像:docker images
删除容器:docker rm container_name  
删除镜像:docker rmi images_name

启动镜像容器:
(后台):docker run -itd --name container_name  -p sever_port:docker_port images_name:tag
(临时):docker run -it --rm --name container_name  -p sever_port:docker_port images_name:tag

进入容器:docker exec -it container_id bash  (退出后容器不停止)
退出容器:Ctrl+D
将容器打包成镜像:docker commit container_id images_name:tag

文件传输:
(本地到容器) docker cp ./ container_name:/path
(容器到本地) docker cp  container_name:/path ./

Dockerfile
FROM lk_compare:v2.0
COPY ./ /python36-workspace/pdfcompare_docker
WORKDIR /python36-workspace/pdfcompare_docker
CMD ["sh","run.sh"]
(补充)

通过dockerfile构建镜像:docker build -t images_name:tag
更改镜像标签:docker tag images_name:tag username/repository存储库:tag
上传到远程:docker push username/repository:tag
从远程下载镜像:docker pull username/repository:tag

镜像导出:docker save images_name:tag -o **.tar

你可能感兴趣的:(centos7,docker)