Skip to content

Instantly share code, notes, and snippets.

@sfoolish
Created December 21, 2016 01:50
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save sfoolish/090c93a1ff417cbed3b148b07f501ab2 to your computer and use it in GitHub Desktop.
Save sfoolish/090c93a1ff417cbed3b148b07f501ab2 to your computer and use it in GitHub Desktop.
Kolla Multinode Local Registry Setup

Kolla Multinode Local Registry Setup

Deploy node setup

install and configure docker

curl -sSL https://get.docker.io | bash
mkdir -p /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF'
[Service]
MountFlags=shared
EOF
systemctl daemon-reload
systemctl restart docker

start local registry

docker run -d -p 4000:5000 --restart=always --name registry registry:2

install kolla and pull image from docker hub

yum install -y epel-release
yum install -y python-pip
yum install -y vim wget
pip install -U pip

yum install -y ansible
pip install kolla
cp -r /usr/share/kolla/etc_examples/kolla /etc/

kolla-ansible pull

push kolla images to local registry

# push all image to local registry, e.g.:
#     docker tag kolla/centos-binary-heat-api:3.0.1 \
#         localhost:4000/kolla/centos-binary-heat-api:3.0.1
#     docker push localhost:4000/kolla/centos-binary-heat-api:3.0.1
docker images | grep kolla | grep -v local | awk '{print $1,$2}' | while read -r image tag; do
    docker tag ${image}:${tag} localhost:4000/${image}:${tag}
    docker push localhost:4000/${image}:${tag}
done

Target nodes setup

install and configure docker

curl -sSL https://get.docker.io | bash
echo 'INSECURE_REGISTRY="--insecure-registry 192.168.122.71:4000"' > /etc/sysconfig/docker

tee /etc/systemd/system/docker.service <<-'EOF'
# CentOS
[Service]
MountFlags=shared
EnvironmentFile=/etc/sysconfig/docker
ExecStart=/usr/bin/docker daemon $INSECURE_REGISTRY
EOF

systemctl daemon-reload
systemctl restart docker

try to pull a kolla image from local registry

docker pull kolla/centos-binary-kolla-toolbox:3.0.1

list local images

docker images

Reference

@frct1
Copy link

frct1 commented Oct 10, 2022

Hi
If you reading this you probably in weird situation with images from quay.io like me. So use this one:

docker images | grep kolla | grep -v local | awk '{print $1,$2}' | while read -r image tag; do
    new_image_name=${image#"quay.io/"}
    docker tag ${image}:${tag} "localhost:4000"/${new_image_name}:${tag}
    docker push localhost:4000/${new_image_name}:${tag}
done

@katringoogoo
Copy link

katringoogoo commented Dec 13, 2022

i setup my local machine (which is not part of the cluster and can reach the external network) as kolla host and used kolla-ansible pull to get the images ... then the above snippets to push it to my local docker registry 👍

@satishdotpatel
Copy link

What are the advantage of maintaining local copy of registry? Just to save cost of bandwidth or are there any bigger advantage here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment