-
参考
-
命令
卸载
yum install -y yum-utils
安装依赖
yum install -y yum-utils \
安装Docker
yum install docker
CentOS简化安装脚本
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
启动Docker-CE
systemctl enable docker
systemctl start docker
systemctl start docker.service
将名字为hello-world的镜像文件从仓库抓取到本地
docker pull library/hello-world
查看镜像
docker images
运行镜像
docker run 镜像名称
启动、重启、停止容器
docker start container_name/container_id
docker restart container_name/container_id
docker stop container_name/container_id
删除容器
docker rm container_name/container_id
删除镜像
docker rmi image_name
显示正在运行的容器
docker ps
docker container ls
显示正在运行的容器,包括未运行的
docker ps -a
启动Docker Daemon
docker --daemon = true
docker –d
docker –d = true
查看docker命令
docker -h
-
容器命令
进入容器
docker exec -it mytomcat bash
从主机复制到容器
docker cp host_path containerID:container_path
从容器复制到主机
docker cp containerID:container_path host_path
-
docker 容器中安装命令
apt-get update ##跟新
//vi
apt install vim
//weget
apt install weget
//yum
apt install yum
//ifconfig
apt install net-tools
//ping
apt install iputils-ping
-
镜像使用
tomcat
-
问题及解决
Cannot connect to the Docker daemon at unix
systemctl daemon-reload
service docker restart