Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 1.35 KB

Docker_Commands.MD

File metadata and controls

67 lines (52 loc) · 1.35 KB
  1. how to search a docker image in hub.docker.com
docker search httpd
  1. Download a docker image from hub.docker.com
docker image pull <image_name>:<image_version/tag>
  1. List out docker images from your local system
docker image ls
  1. Create/run/start a docker container from image
docker run -d --name <container_Name> <image_name>:<image_version/tag>

d - run your container in back ground (detached)
  1. Expose your application to host server
docker run -d  -p <host_port>:<container_port> --name <container_Name> <image_name>:<Image_version/tag>

docker run -d --name httpd_server -p 8080:80 httpd:2.2
  1. List out running containers
docker ps
  1. List out all docker container (running, stpooed, terminated, etc...)
docker ps -a
  1. run a OS based container which interactive mode (nothing but login to container after it is up and running)
docker run -i -t --name centos_server centos:latest
i - interactive
t - Terminal
  1. Stop a container
docker stop <container_id>
  1. Start a container which is in stopped or exit state
docker start <container_id>
  1. Remove a container
docker rm <container_id>
  1. login to a docker container
docker exec -it <container_Name> /bin/bash