====== 22 Docker Private registry ======
Docker用のローカルRepogitoryを用意してみる。
===== Port:4000でローカルregistry用意 =====
docker run -d \
--name registry \
--restart=always \
-p 4000:5000 \
-v registry:/var/lib/registry \
registry:2
===== image作成 =====
[[06_virtualization:05_container:11_docker_create_image]]
==== insecure(HTTP)で通信できるようにしておく ====
# cat << __EOM__ | tee /etc/docker/daemon.json
{ "insecure-registries":["192.168.10.10:4000"] }
__EOM__
systemctl restart docker
===== image push =====
タグを付けて
docker tag my-centos7:latest 192.168.10.10:4000/my-centos7:latest
Push
docker push 192.168.10.10:4000/my-centos7:latest
確認
$ curl -sk http://192.168.10.10:4000/v2/_catalog | jq
{
"repositories": [
"my-centos7"
]
}
他のノードからPullしてみる
docker pull 192.168.10.10:4000/my-centos7
===== image一覧確認 =====
$ curl -sk http://192.168.10.10:4000/v2/_catalog | jq
{
"repositories": [
"kolla/cinder-api",
"kolla/cinder-scheduler",
"kolla/cinder-volume",
"kolla/cron",
"kolla/fluentd",
"kolla/glance-api",
"kolla/haproxy",
"kolla/heat-api",
"kolla/heat-api-cfn",
"kolla/heat-engine",
"kolla/horizon",
"kolla/keepalived",
"kolla/keystone",
"kolla/keystone-fernet",
"kolla/keystone-ssh",
"kolla/kolla-toolbox",
"kolla/mariadb-clustercheck",
"kolla/mariadb-server",
"kolla/memcached",
"kolla/neutron-dhcp-agent",
"kolla/neutron-l3-agent",
"kolla/neutron-metadata-agent",
"kolla/neutron-openvswitch-agent",
"kolla/neutron-server",
"kolla/nova-api",
"kolla/nova-compute",
"kolla/nova-conductor",
"kolla/nova-libvirt",
"kolla/nova-novncproxy",
"kolla/nova-scheduler",
"kolla/nova-ssh",
"kolla/openvswitch-db-server",
"kolla/openvswitch-vswitchd",
"kolla/placement-api",
"kolla/rabbitmq",
"kolla/test"
]
}
===== imageのタグ一覧 =====
$ curl -sk http://192.168.10.201:4000/v2/kolla/haproxy/tags/list | jq
{
"name": "kolla/haproxy",
"tags": [
"xena",
"yoga"
]
}
===== 実ファイルのpath =====
docker volumesの下にregistryというフォルダができてるので、それをバックアップしておけば良いと思います。
# # ls -al /var/lib/docker/volumes/registry
total 12
drwx-----x 3 root root 4096 Aug 31 06:22 .
drwx-----x 3 root root 4096 Aug 31 06:22 ..
drwxr-xr-x 3 root root 4096 Aug 31 06:54 _data
# ls -al /var/lib/docker/volumes/registry/_data/docker/registry/v2/repositories/kolla/
total 164
drwxr-xr-x 41 root root 4096 Aug 31 07:01 .
drwxr-xr-x 3 root root 4096 Aug 31 06:54 ..
drwxr-xr-x 5 root root 4096 Aug 31 06:54 base
drwxr-xr-x 5 root root 4096 Aug 31 06:55 cinder-api
drwxr-xr-x 5 root root 4096 Aug 31 06:55 cinder-backup
drwxr-xr-x 5 root root 4096 Aug 31 06:55 cinder-base
drwxr-xr-x 5 root root 4096 Aug 31 06:55 cinder-scheduler
drwxr-xr-x 5 root root 4096 Aug 31 06:55 cinder-volume
drwxr-xr-x 5 root root 4096 Aug 31 07:01 cron
drwxr-xr-x 5 root root 4096 Aug 31 07:01 fluentd
drwxr-xr-x 5 root root 4096 Aug 31 06:57 glance-api
drwxr-xr-x 5 root root 4096 Aug 31 07:01 haproxy
drwxr-xr-x 5 root root 4096 Aug 31 06:57 heat-api
drwxr-xr-x 5 root root 4096 Aug 31 06:57 heat-api-cfn
drwxr-xr-x 5 root root 4096 Aug 31 06:57 heat-engine
drwxr-xr-x 5 root root 4096 Aug 31 06:57 horizon
drwxr-xr-x 5 root root 4096 Aug 31 07:01 keepalived
drwxr-xr-x 5 root root 4096 Aug 31 06:58 keystone
drwxr-xr-x 5 root root 4096 Aug 31 06:58 keystone-fernet
drwxr-xr-x 5 root root 4096 Aug 31 06:58 keystone-ssh
drwxr-xr-x 5 root root 4096 Aug 31 07:01 kolla-toolbox
drwxr-xr-x 5 root root 4096 Aug 31 06:58 mariadb-clustercheck
drwxr-xr-x 5 root root 4096 Aug 31 06:58 mariadb-server
drwxr-xr-x 5 root root 4096 Aug 31 07:01 memcached
drwxr-xr-x 5 root root 4096 Aug 31 06:57 neutron-dhcp-agent
drwxr-xr-x 5 root root 4096 Aug 31 06:57 neutron-l3-agent
drwxr-xr-x 5 root root 4096 Aug 31 06:57 neutron-metadata-agent
drwxr-xr-x 5 root root 4096 Aug 31 06:57 neutron-openvswitch-agent
drwxr-xr-x 5 root root 4096 Aug 31 06:57 neutron-server
drwxr-xr-x 5 root root 4096 Aug 31 06:57 nova-api
drwxr-xr-x 5 root root 4096 Aug 31 06:56 nova-compute
drwxr-xr-x 5 root root 4096 Aug 31 06:57 nova-conductor
drwxr-xr-x 5 root root 4096 Aug 31 07:00 nova-libvirt
drwxr-xr-x 5 root root 4096 Aug 31 06:56 nova-novncproxy
drwxr-xr-x 5 root root 4096 Aug 31 06:57 nova-scheduler
drwxr-xr-x 5 root root 4096 Aug 31 06:56 nova-ssh
drwxr-xr-x 5 root root 4096 Aug 31 06:55 openstack-base
drwxr-xr-x 5 root root 4096 Aug 31 07:00 openvswitch-db-server
drwxr-xr-x 5 root root 4096 Aug 31 07:00 openvswitch-vswitchd
drwxr-xr-x 5 root root 4096 Aug 31 06:57 placement-api
drwxr-xr-x 5 root root 4096 Aug 31 07:01 rabbitmq
{{tag>Docker}}