Understanding about Dockerfile, docker diff commands

Created container from image made some changes used docker diff command to see the changes and created image of container and then created another container of the updated image so that created file was visible to me in the new container.

Steps to create Dockerfile

  1. Create a file named Dockerfile

  2. Add instructions in Dockerfile

  3. Build Dockerfile to create image

  4. Run image to create container

To create image out of Dockerfile

docker build -t myimage

docker ps -a

docker images

Then to create container from image

docker run -it --named container4 myimage /bin/bash

Instructions in Dockerfile

  1. FROM- The base image

  2. RUN- To execute commands

  3. LABEL- Author

  4. COPY- To copy files from source to destination

  5. ADD- To add URL's or download files and extract tar files

  6. EXPOSE- To expose ports

  7. WORKDIR- To set working directory

  8. CMD- To specify default commands to run when a container starts

  9. ENV- To define environment variable