Skip to content

Commit c193841

Browse files
author
sophia parafina
committed
fixed hostname, added mac/win config
1 parent 4892e51 commit c193841

File tree

6 files changed

+19
-22
lines changed

6 files changed

+19
-22
lines changed

registry/.DS_Store

-2 KB
Binary file not shown.

registry/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ You'll learn how to:
1616
1717
### Prerequisites
1818

19-
You'll need Docker running on Linux, Mac OSX or on AWS and Azure.
20-
21-
You should be familiar with the key Docker concepts, and with Docker volumes:
19+
You'll need Docker running on Linux and be familiar with the key Docker concepts, and with Docker volumes:
2220

2321
- [Docker concepts](https://docs.docker.com/engine/understanding-docker/)
2422
- [Docker volumes](https://docs.docker.com/engine/tutorials/dockervolumes/)
60.2 KB
Loading
Loading

registry/part-1.md

+15-16
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ The Docker Engine needs to be explicitly setup to use HTTP for the insecure regi
1111
$ sudo vi /etc/docker/docker
1212
1313
# add this line
14-
DOCKER_OPTS="--insecure-registry <localhost>:5000"
14+
DOCKER_OPTS="--insecure-registry localhost:5000"
1515
```
16-
- where `localhost`0 is the name of your machine, which can be found with the `hostname` command
17-
18-
```
19-
$ hostname
20-
```
21-
2216
Close and save the file, then restart the docker daemon.
2317
```
2418
$ sudo service docker restart
2519
```
20+
In Docker for Mac, the `Preferences` menu lets you set the address for an insecure registry under the `Daemon` panel:
21+
![MacOS menu](images/docker_osx_insecure_registry.png)
22+
23+
In Docker for Windows, the `Settings` menu lets you set the address for an insecure registry under the `Daemon` panel:
24+
![MacOS menu](images/docker_windows_insecure_registry.png)
2625
## Testing the Registry Image
2726
First we'll test that the registry image is working correctly, by running it without any special configuration:
2827
```
@@ -41,7 +40,7 @@ $ sudo docker pull hello-world
4140

4241
If a tag isn't specified, then the default `latest` is used. If a registry hostname isn't specified then the default `docker.io` for Docker Hub is used. If you want to use images with any other registry, you need to explicitly specify the hostname - the default is always Docker Hub, you can't change to a different default registry.
4342

44-
With a local registry, the hostname and the custom port used by the registry is the full registry address, e.g. `<hostname>:5000`.
43+
With a local registry, the hostname and the custom port used by the registry is the full registry address, e.g. `localhost:5000`.
4544
```
4645
$ hostname
4746
```
@@ -50,27 +49,27 @@ $ hostname
5049

5150
Docker uses the hostname from the full image name to determine which registry to use. We can build images and include the local registry hostname in the image tag, or use the `docker tag` command to add a new tag to an existing image.
5251

53-
These commands pull a public image from Docker Hub, tag it for use in the private registry with the full name `<hostname>:5000/hello-world`, and then push it to the registry:
52+
These commands pull a public image from Docker Hub, tag it for use in the private registry with the full name `localhost:5000/hello-world`, and then push it to the registry:
5453

5554
```
56-
$ sudo docker tag hello-world <hostname>:5000/hello-world
57-
$ sudo docker push <hostname>:5000/hello-world
55+
$ sudo docker tag hello-world localhost:5000/hello-world
56+
$ sudo docker push localhost:5000/hello-world
5857
```
5958

6059
When you push the image to your local registry, you'll see similar output to when you push a public image to the Hub:
6160

6261
```
63-
The push refers to a repository [<hostname>:5000/hello-world]
62+
The push refers to a repository [localhost:5000/hello-world]
6463
a55ad2cda2bf: Pushed
6564
cfbe7916c207: Pushed
6665
fe4c16cbf7a4: Pushed
6766
latest: digest: sha256:79e028398829da5ce98799e733bf04ac2ee39979b238e4b358e321ec549da5d6 size: 948
6867
```
6968
On the local machine, you can remove the new image tag and the original image, and pull it again from the local registry to verify it was correctly stored:
7069
```
71-
$ sudo docker rmi <hostname>:5000/hello-world
70+
$ sudo docker rmi localhost:5000/hello-world
7271
$ sudo docker rmi hello-world
73-
$ sudo docker pull <hostname>:5000/hello-world
72+
$ sudo docker pull localhost:5000/hello-world
7473
```
7574
That exercise shows the registry works correctly, but at the moment it's not very useful because all the image data is stored in the container's writable storage area, which will be lost when the container is removed. To store the data outside of the container, we need to mount a host directory when we start the container.
7675

@@ -92,8 +91,8 @@ registry
9291
```
9392
Tag and push the container with the new IP address of the registry.
9493
```
95-
docker tag hello-world <hostname>:5000/hello-world
96-
docker push <hostname>:5000/hellow-world
94+
docker tag hello-world localhost:5000/hello-world
95+
docker push localhost:5000/hellow-world
9796
```
9897
Repeating the previous `docker push` command uploads an image to the registry container, and the layers will be stored in the container's `/var/lib/registry` directory, which is actually mapped to the `$(pwd)/registry-data` directory on you local machine. The `tree` command will show the directory structure the registry server uses:
9998

registry/part-2.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ State or Province Name (full name) [Some-State]:
2828
Locality Name (eg, city) []:
2929
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker
3030
Organizational Unit Name (eg, section) []:
31-
Common Name (e.g. server FQDN or YOUR name) []:<hostname>
31+
Common Name (e.g. server FQDN or YOUR name) []:localhost
3232
Email Address []:
3333
```
3434
If you are running the registry locally, be sure to use your host name as the CN.
@@ -82,8 +82,8 @@ We'll let Docker assign a random IP address to this container, because we'll be
8282

8383
We're ready to push an image into our secure registry.
8484
```
85-
$ docker push <hostname>:5000/hello-world
86-
$ docker pull <hostname>:5000/hello-world
85+
$ docker push localhost:5000/hello-world
86+
$ docker pull localhost:5000/hello-world
8787
```
8888
We can go one step further with the open-source registry server, and add basic authentication - so we can require users to securely log in to push and pull images.
8989

0 commit comments

Comments
 (0)