Managing Your Docker Images and Containers

Basic Commands For Managing Docker images:-  

1.Pulling Docker Image from registries :

$ docker pull  <docker image name>

2.List images :

$ docker images

3.Remove images :

$ docker rmi  <docker image name> 

Basic Commands For Managing Docker Container:-

1.Running interactive container

$ docker run -it <docker image name>  sh

2.Running a daemon/detach container

$ docker run -d  <docker image name>

3.Listing containers

$ docker ps

$ docker ps -a

4.Remove a container

$ docker rm  <container id>

5.Connect to a running container

$ docker exec -it  sh <container id> 

/ #

Task by trainer:

  • Pull ubuntu image on local system.
  • Run ubuntu image container  with name  “Myapp” in detach mode.  
  • Create /sample folder in a ubuntu container. 
  • And also create abc.txt  file In a /sample folder.