Document

SUBSCRIBE TO GET FULL ACCESS TO THE E-BOOKS FOR FREE 🎁SUBSCRIBE NOW

Professional Dropdown with Icon

SUBSCRIBE NOW TO GET FREE ACCESS TO EBOOKS

Docker Custom Images

docker commit

Description

Create a new image from a container’s changes

Syntax

docker commit <<container id>> <<new image name>>


Example ( To create an image from nginx container)

docker container run -it –name nginxc -d nginx

docker commit nginxc webserverimg

Verify the Image is in the List

docker images


Assignment

Note: service apache2 start  to start the apache service in the container

1. Create a container with an ubuntu image

2. update the repository (apt update -y) in the container

3. install apache2 in a container ( apt install apache2 -y)

4. Create a directory config under /config in the container

5. Add web.config file under /config folder

6. copy an html file from your host machine to container /var/www/html

7. Verify your container is able to browse your html file (curl localhost) ( To install the curl  apt install curl)

8. Create a production image (prod/webapp)

9. remove all the containers ( docker rm -f $(docker ps -a -q)

10 create a new container with prod/webapp with 80 container port forwarding and verify you are able to access the website and in the container /config directory exist with web.config file


Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *