1. close Selinux
2.check
3. Uninstall old versions
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
4. SET UP THE REPOSITORY
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
5. install docker
yum install docker-io
6. run the test image
docker run hello-world
7. list the images have stored
docker image ls
8 list the run container
docker ps --all
9.build a docker image with the example: git clone https://github.com/dockersamples/node-bulletin-board
9.1 build the image with : docker build --tag bulletinboard:1.0 .
9.2 run the container : docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0
--publish
8000 container port 8080 app port
--detach run background
--name the name
bulletinboard:1.0 :the tag
修改为中国的镜像地址:
因为众所周知的原因,在docker官方仓库拉取镜像会特别慢,所以我们需要修改docker镜像地址
在宿主机器编辑文件:vi /etc/docker/daemon.json
请在该配置文件中加入(没有该文件的话,请先建一个):
{"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]}
最后,需要重启docker服务 systemctl restart docker
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31506529/viewspace-2682802/ ,如需转载,请注明出处,否则将追究法律责任。