Skip to content
Permalink
Browse files

fix the script and enhance the doc

  • Loading branch information
brightzheng100 committed Nov 21, 2019
1 parent 226c290 commit 88477fae00edab4cf28b15722977fa71d177f82a
Showing with 8 additions and 5 deletions.
  1. +8 −5 site/content/docs/user/local-registry.md
@@ -22,6 +22,7 @@ with it enabled.
set -o errexit
# create registry container unless it already exists
CLUSTER_NAME="my-cluster" # desired cluster name; default is "kind"
REGISTRY_CONTAINER_NAME='kind-registry'
REGISTRY_PORT='5000'
if [ "$(docker inspect -f '{{.State.Running}}' "${REGISTRY_CONTAINER_NAME}")" != 'true' ]; then
@@ -39,7 +40,7 @@ containerdConfigPatches:
EOF
# add the registry to /etc/hosts on each node
for node in $(kind get nodes); do
for node in $(kind get nodes --name ${CLUSTER_NAME}); do
docker exec "${node}" sh -c "echo $(docker inspect --format '{{.NetworkSettings.IPAddress }}' "${REGISTRY_CONTAINER_NAME}") registry >> /etc/hosts"
done
```
@@ -48,10 +49,12 @@ done

The registry can be used like this.

1. First we'll pull an images `docker pull gcr.io/google-samples/hello-app:1.0`
1. First we'll pull an image `docker pull gcr.io/google-samples/hello-app:1.0`
2. Then we'll tag the image to use the local registry `docker tag gcr.io/google-samples/hello-app:1.0 localhost:5000/hello-app:1.0`
3. Then we'll push it to the registry `docker push localhost:5000/hello-app:1.0`
4. And now we can run the image `kubectl create deployment hello-server --image=registry:5000/hello-app:1.0`
4. And now we can use the image `kubectl create deployment hello-server --image=registry:5000/hello-app:1.0`

If you build your own images and tag them with `localhost:5000/image:foo` and then use
them in kubernetes as `registry:500/image:foo`.
If you build your own image and tag it like `localhost:5000/image:foo` and then use
it in kubernetes as `registry:5000/image:foo`.

> Note: you may update your local hosts file as well, for example by adding `127.0.0.1 registry` in your laptop's `/etc/hosts`, so you can reference it in a consistent way by simply using `registry:5000`.

0 comments on commit 88477fa

Please sign in to comment.
You can’t perform that action at this time.