Enabling command prompt inside a Container

To run another command inside a container you use docker exec every time but by enabling shell or terminal access in the container you won’t have to use this again.

Here is the docker command which you use to enable shell access inside a container:

$ docker exec -it <container ID> sh

where exec is used to run another command, -it is input flag, and sh is shell enablement

Below image shows you the example:

you can see shell access is enabled for container. “ls” lists the directory folders inside the container, echo command prints
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s