docker常用命令

来源:互联网 发布:aso优化 排名aso 编辑:程序博客网 时间:2024/06/08 06:55

docker 安装

参见 https://docs.docker.com/engine/installation/linux/centos/

curl -fsSL https://get.docker.com/ | sh

docker 常用命令

docker服务

## 启停重启服务service docker start(stop restart)## 开机启动systemctl enable docker.service

docker镜像、容器

## 显示docker镜像docker images## 删除docker镜像docker rmi -f [imageid]## 显示docker容器docker ps## 停止docker容器docker stop [containerId]## 删除docker容器docker rmi -f [containerId]

启动容器

docker run [imageId]-d 后台运行-p 默认桥接网络模式,映射端口--net=host 网络主机模式-v 挂载容器和主机间的路径--restart=always 随着docker服务开机启动

上传下载

##下载docker pull 192.168.1.106:5000/ht/tomcat:8##上传##打版本docker tag tomcat:8 192.168.1.106:5000/ht/tomcat:8##上传docker push 192.168.1.106:5000/ht/tomcat:8

容器其它命令

## 进入容器docker exec [containerId] -it bash## 执行命令docker exec [containerId] -it [command]## 容器控制台日志docker logs -f [containerId]
0 0
原创粉丝点击