DevOps Classroomnotes 25/Aug/2023

Activities

  • Create a linux vm and install docker in it
  • Create a container with name myhttpd1 and image httpd
  • Create a container with name myhttpd2 and image httpd and forwarding 80 port of the container to 32000 port of the linux vm
  • Create a container with name interactive and image alpine.
  • Verify the containers which are running
  • myhttpd1 and myhttpd2 will be in running state and interactive will be in exited state
    Preview
  • Lets remove all the containers docker container rm -f $(docker container ls -a -q)
    Preview
  • Lets remove all the images docker image rm -f $(docker image ls -q)
    Preview
  • Lets create a container and login into that during running the container. Lets use alpine and ubuntu docker images
    Preview
    Preview
  • Lets create the nginx container in detached mode -d
    Preview
  • Lets create the nginx container in attached mode
    Preview
  • IN detached mode the container will be started in the background whereas in attached mode the container will be started in foreground and STDIN, STDOUT, STDERR of the container will be attached to your terminal. Your terminal becomes unusable.
  • To come out of this execute Ctrl+C and this will stop container execution
    Preview

Observations

  • Not all the containers when executed will be in running state. the alpine container with the name interactive went into exited state
  • Docker container can be executed in 3 ways
    • detached
    • attached
    • interactive

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner