Deploying Docker images

Now that we have contained our Vault service inside a Docker container, we are going to do some useful things with it.

The first thing we are going to do is push this to the Docker Hub so that other people may spin up their own instances or even build new images based on it.

Deploying to Docker Hub

Head over to Docker Hub at https://hub.docker.com and create an account by clicking on the Log In link in the top-right-hand corner and then clicking on Create Account. Of course, if you already have an account, just log in.

Now in a terminal, you are going to authenticate with this account by running Docker's login command:

docker login -u USERNAME -p PASSWORD https://index.docker.io/v1/

Tip

If you see an error such as WARNING: Error loading config, permission denied, then try the command again with the sudo command prefix. This goes for all of Docker commands from this point onwards, since we're using a secured configuration.

Ensure that you replace USERNAME and PASSWORD with your actual username and password of the account you just created.

If successful, you'll see, Login Succeeded.

Next, back in the web browser, click on Create Repository and create a new repository called  vault. The actual name for this image is going to be  USERNAME/vault, so we're going to need to rebuild the image locally to match this.

Tip

Note that for public consumption, we are calling the image vault rather than vaultd. This is a deliberate difference so that we can make sure we are dealing with the right image, but this is also a better name for users anyway.

In a terminal, build the new repository with the correct name:

docker build -t USERNAME/vault

This will build the image again, this time with the appropriate name. To deploy the image to the Docker Hub, we use Docker's push command:

docker push USERNAME/vault

After some time, the image and its dependencies will be pushed to Docker Hub:

f477b97e9e48: Pushed
384c907d1173: Pushed
80168d020f50: Pushed
0ceba54dae47: Pushed
4d7388e75674: Pushed
f042db76c15c: Pushing [====>               ] 21.08 MB/243.6 MB
d15a527c2ee1: Pushing [=====>              ] 15.77 MB/134 MB
751f5d9ad6db: Pushing [======>             ] 16.49 MB/122.6 MB
17587239b3df: Pushing [===================>] 17.01 MB/44.31 MB
9e63c5bce458: Pushing [==================> ] 65.58 MB/125.1 MB

Now head over to the Docker Hub to see the details of your image, or look at an example at https://hub.docker.com/r/matryer/vault/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.75.217