1 install docker
wget -qO- https://get.docker.com/ | sh ##docker 安装
systemctl enable docker
systemctl start docker
2 本地docker 仓库搭建
docker pull registry
mkdir -p /data/registry
docker run -itd -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest
curl http://127.0.0.1:5000/v2/_catalog
3 基础镜像·拉取
docker pull centos
docker images
4 根据拉取的镜像,运行容器 以准备镜像环境测定 docker run
docker run -d -it --privileged --name centos-test centos /usr/sbin/init /bin/bash -c 'tail -f /tmp/null'
5 docker ps -a
进入容器: docker exec -it `docker ps | grep nginx | awk '{print $1}'` /bin/bash
docker cp Python-3.7.0a1.tar.xz f3a159f3c3a8:/root
#docker rm -f
6 提交 docker images
docker ps | grep centos
#提交信息 -a author -m commit docker_id imagine_name
docker commit -a "test" -m "test" 0ea857a05646 test:001
docker tag test:001 127.0.0.1:5000/test:001
docker push 127.0.0.1:5000/test:001
网友评论