DevOps Classroom notes 03/Sep/2026

Run container in Docker host

# pull image (download image to local)
docker pull httpd:latest

To run a container we need a port

Types of ports in docker:

  1. Static port -p <port to access>:<application port>

Ex: apache application port 80

-p 8080:80

docker images
                                                                 i Info →   U  In Use
IMAGE             ID             DISK USAGE   CONTENT SIZE   EXTRA
demo-ubuntu:1.0   2b4a4d589d5e        157MB         41.6MB
httpd:2.4.68      979c38c2228d        177MB         47.6MB
httpd:latest      979c38c2228d        177MB         47.6MB

docker run -dit –name apache2 -p 8080:80 httpd:latest

Dynamic port

docker run -dit –name tomcat -P tomcat:9.0

Stop and clean containers and images

  1. Container commands
docker stop <container id>
docker rm <container id>
docker rm -f <container id>
docker rm -f $(docker ps -a -q)

## Create container
docker create --name tomcat2 -p 8081:8080 tomcat:9.0

## Start container
docker start <container id>

## docker run
docker create + docker start

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%