docker:images:update_and_commit_an_image
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docker:images:update_and_commit_an_image [2020/11/11 10:07] – created 192.168.1.1 | docker:images:update_and_commit_an_image [2020/11/11 10:25] (current) – 192.168.1.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Docker - Images - Update and Commit an Image ====== | ====== Docker - Images - Update and Commit an Image ====== | ||
- | Pull an image. | + | ===== Pull an image ===== |
+ | |||
+ | For example, to pull the Ubuntu 20.04 Docker image from the Docker Hub. | ||
<code bash> | <code bash> | ||
Line 7: | Line 9: | ||
</ | </ | ||
+ | ---- | ||
+ | |||
+ | ===== Create a new container ===== | ||
Create a new container from the Ubuntu 20.04 image. | Create a new container from the Ubuntu 20.04 image. | ||
Line 14: | Line 19: | ||
</ | </ | ||
- | This will create a new container and attach to the bash shell as shown below: | + | This will create a new container and attach to the bash shell as shown below: |
<code bash> | <code bash> | ||
Line 20: | Line 25: | ||
</ | </ | ||
- | Now, install | + | ---- |
+ | |||
+ | ===== Install NginX into the Container ===== | ||
+ | |||
+ | Install | ||
<code bash> | <code bash> | ||
Line 27: | Line 36: | ||
</ | </ | ||
- | Next, exit from the container with the following command: | + | ---- |
+ | |||
+ | |||
+ | ===== Exit from the Container ===== | ||
<code bash> | <code bash> | ||
Line 33: | Line 46: | ||
</ | </ | ||
- | Next, locate | + | ---- |
+ | |||
+ | ===== Obtain the Container ID ===== | ||
+ | |||
+ | Locate | ||
<code bash> | <code bash> | ||
Line 39: | Line 56: | ||
</ | </ | ||
- | You should get the container ID in the following output: | + | returns: |
<code bash> | <code bash> | ||
Line 46: | Line 63: | ||
</ | </ | ||
- | Next, save the updated container with a new image named nginx-instance | + | ---- |
+ | |||
+ | ===== Save the Updated Container ===== | ||
+ | |||
+ | Save the updated container with a new image named nginx-instance: | ||
<code bash> | <code bash> | ||
Line 54: | Line 75: | ||
* Where: | * Where: | ||
- | You can now verify your newly created image “nginx-instance” | + | ---- |
+ | |||
+ | ===== Verify the newly created Image ===== | ||
+ | |||
+ | |||
+ | Verify the newly created image “nginx-instance”: | ||
<code bash> | <code bash> | ||
Line 60: | Line 86: | ||
</ | </ | ||
- | You should get the following output: | + | returns: |
<code bash> | <code bash> | ||
Line 67: | Line 93: | ||
ubuntu | ubuntu | ||
</ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Log in to the Docker Hub ===== | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** In order to work with the Docker Hub, you will need to create an account on [[https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | docker login | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Username: peter | ||
+ | Password: | ||
+ | WARNING! Your password will be stored unencrypted in / | ||
+ | Configure a credential helper to remove this warning. See | ||
+ | https:// | ||
+ | |||
+ | Login Succeeded | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Tag the Image to push to the Docker Hub ===== | ||
+ | |||
+ | For example, to tag the nginx-instance image: | ||
+ | |||
+ | <code bash> | ||
+ | docker tag 12cefc9b5362 peter/ | ||
+ | </ | ||
+ | |||
+ | where: | ||
+ | |||
+ | * 12cefc9b5362 is the ID of the nginx-instance image. | ||
+ | * peter is your Docker Hub username. | ||
+ | * nginx-instance is the name of the image that you want to push. | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Verify the Tagged Image ===== | ||
+ | |||
+ | <code bash> | ||
+ | docker images | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | REPOSITORY | ||
+ | peter/ | ||
+ | nginx-instance | ||
+ | ubuntu | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Push the new Image to the Docker Hub ===== | ||
+ | |||
+ | Push the new image named peter/ | ||
+ | |||
+ | <code bash> | ||
+ | docker push peter/ | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Login to the Docker Hub ===== | ||
+ | |||
+ | Login to the Docker Hub using your web browser and verify that the nginx-instance image appears in the Repositories. | ||
+ | |||
docker/images/update_and_commit_an_image.1605089243.txt.gz · Last modified: 2020/11/11 10:07 by 192.168.1.1