Pushing to the hub

This commit is contained in:
Jérôme Petazzoni
2017-11-08 13:31:22 -08:00
parent f0f03e2440
commit f7f0ecddd4

View File

@@ -2,19 +2,72 @@
We have built our first images.
If we were so inclined, we could share those images through the Docker Hub.
We can now publish it to the Docker Hub!
We won't do it since we don't want to force everyone to create a Docker Hub account (although it's free, yay!) but the steps would be:
*Note: you don't have to do the exercises in this section,
because they require an account on the Docker Hub, and we
don't want to force anyone to create one.*
* have an account on the Docker Hub
*Note, however, that creating an account on the Docker Hub
is free (and doesn't require a credit card), and hosting
public images is free as well.*
* tag our image accordingly (i.e. `username/imagename`)
---
* `docker push username/imagename`
## Logging into our Docker Hub account
Anybody can now `docker run username/imagename` from any Docker host.
* This can be done from the Docker CLI:
```bash
docker login
```
Images can be set to be private as well.
.warning[When running Docker4Mac, Docker4Windows, or
Docker on a Linux workstation, it can (and will when
possible) integrate with your system's keyring to
store your credentials securely. However, on most Linux
servers, it will store your credentials in `~/.docker/config`.]
---
## Image tags and registry addresses
* Docker images tags are like Git tags and branches.
* They are like *bookmarks* pointing at a specific image ID.
* Tagging an image doesn't *rename* an image: it adds another tag.
* When pushing an image to a registry, the registry address is in the tag.
Eample: `registry.example.net:5000/image`
* What about Docker Hub images?
--
* `jpetazzo/clock` is, in fact, `index.docker.io/jpetazzo/clock`
* `ubuntu` is, in fact, `library/ubuntu`, i.e. `index.docker.io/library/ubuntu`
---
## Tagging an image to push it on the Hub
* Let's tag our `figlet` image (or any other to our liking):
```bash
docker tag figlet jpetazzo/figlet
```
* And push it to the Hub:
```bash
docker push jpetazzo/figlet
```
* That's it!
--
* Anybody can now `docker run jpetazzo/figlet` anywhere.
---