Docker Container

Docker Container

 Docker Container

Docker container is a running instance of an image. A container combined only libraries and settings required to make the application work. It is a lightweight and portable encapsulated environment for an application.

Run Docker Container

Use the docker run command to launch a Docker container on your system. For example below command will create a Docker container from the hello-world image.

docker run hello-world

Now create a real instance of Docker container using the CentOS operating system. The option -it will provide an interactive session with pseudo-TTY enabled. This provides you container shell immediately.

docker run -it centos

Also, try our customized Ubuntu docker image with ssh access enabled in our docker hub repository.

sudo docker run -d -p 2222:22 test/ubuntu-ssh:16.04

List Docker Containers

Use the docker ps command to list all running containers on your current system. This will not list stopped containers. This will show you the Container ID, name, and other use full information about the container.

docker ps

Use -a option with the above command to list all containers including stopped.

docker ps -a

Find all Details of Container

Use the docker inspect command to find all details about a docker container. You need to provide a container id or container name to get details of the specific container.

docker inspect cc5d74cf8250

Delete Docker Container

Use the docker rm command to delete the existing docker container. You need to provide a container id or container name to delete a specific container.

docker stop cc5d74cf8250
docker rm cc5d74cf8250

Post a Comment