基本命令:
sudo docker ps#查看所有容器
sudo docker exec -it 775c7c9ee1e1 /bin/bash#进入容器
如何拉取,上传镜像到Harbor仓库?
docker pull tomcat:8.5.35#name:tag docker images #查看所有镜像 docker push harbor.xxx.com/base-images/python:test #项目:tag
如何从容器到镜像?
1.在容器里从git上拉项目,或者新install 2.docker commit -m “提交说明文字” -a “作者” 要提交的容器名 提交后的镜像名:提交后的镜像tag名 3.docker run --name 容器名 -d nginx:latest#项目:tag
如何查看容器命令行的日志
docker logs -f 容器id
复制一个镜像
docker tag 容器id 新的容器名:tag
服务器重启导致docker服务无法启动
vi /etc/docker/daemon.json添加
{ "registry-mirrors": ["https://registry.docker-cn.com"] }
systemctl restart docker