Create container in docker

How To Create Container In Docker

How To Create a Container using commands and inspect the docker container image. You can also list all the docker containers using an image. I have already downloaded two Apache images from Docker hub as shown in the figure below.

you can also download an image from Docker hub and make your own by Dockerfile in the Linux machine,

Check Out: Remove Image

docker pull image_name

Apache Images Download, To list all images, use docker images

How To Create Container

Let’s Create,

Check Out: How To Uninstall Docker CE

I have created a container using Apache 2.4 image from docker hub & login with bash.

docker run -it –name apachecon e40405f80704 /bin/bash

Apache ID = e40405f80704

Conatiner name = apachecon

Shell= /bin/bash

docker list containers

As you can see Apache configuration files here,

docker container inspect

Note: if you want to come out from the container, use ctrl+p+q, do not use the exit command

Check Out: Rename a Container

If you want to see the running container,

docker ps

docker container commands

Check Out: Create Apache Docker Image Using Dockerfile In Linux

If you want to enter the container, you can use below command,

docker attach apachecon

Now you can do your work here,

YouTube Link: Create Docker Container

You’re done docker container commands docker container inspect docker list containers

Rate this article

Leave a Reply

Notify of