DOCKER 指令

时间:2022-02-03 18:54:16

私有Docker Registry的部署和配置

1 docker pull registry  //获取registry镜像文件

2 

3 docker images  //查看本地的registry镜像文件

4 REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE

5 registry                latest              047218491f8c        4 days ago          33.17 MB

6 

7 docker run -d -p 5000:5000 --restart=always --name registry registry:latest  //运行一个registry的容器

 

配置docker中的josn文件信息:

[[email protected] /]# cd /etc/docker

[[email protected] docker]# ls

daemon.json  key.json

[[email protected] docker]# cat daemon.json 

{

  "registry-mirrors": ["https://apg1cbea.mirror.aliyuncs.com"],

  "insecure-registries":["192.168.1.5:5000"]

}

[[email protected] docker]# 

[[email protected] docker]# service docker restart

Redirecting to /bin/systemctl restart docker.service

[[email protected] docker]# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

mysql               5.6                 0248eeb807c7        2 weeks ago         256MB

registry            latest              d1fd7d86a825        2 months ago        33.3MB

tomcat              8.5                 3dcfe809147d        3 months ago        557MB

[[email protected] docker]# docker pull 192.168.1.5:5000/ipms

[[email protected] docker]# docker tag 192.168.1.5:5000/ipms registry.kcsm.com/ipms

 

在docker-compose中创建相应的配置文件:

[[email protected] usr]# mkdir kcsm

[[email protected] usr]# cd kcsm/

[[email protected] kcsm]# ls 

[[email protected] kcsm]# mkdir docker-compose/ipp

mkdir: 无法创建目录"docker-compose/ipp": 没有那个文件或目录

[[email protected] kcsm]# mkdir docker-compose

[[email protected] kcsm]# cd docker-compose/

[[email protected] docker-compose]# ls

[[email protected] docker-compose]# mkdir ipp

[[email protected] docker-compose]# cd ipp/

[[email protected] ipp]# ls

[[email protected] ipp]# ls

docker-compose.yml

[[email protected] ipp]# docker images