Add new loggedin container
To add a new logged-in container, you can use the following command:
docker run -it --name <container_name> <image_name>
Here:
docker run
is the command to create a new container.-it
options:-i
option keeps the STDIN open even if not attached.-t
option allocates a pseudo-TTY.
--name <container_name>
option gives a name to the container.<image_name>
is the name of the Docker image you want to use.
For example, to create a new container named "my-new-container" using the official Ubuntu image, you can use the following command:
docker run -it --name my-new-container ubuntu
This will create a new container named "my-new-container" and start it with the Ubuntu image. You can then log in to the container using the following command:
docker exec -it my-new-container bash
This will open a new shell session inside the container, and you can interact with it as if you were logged in directly.
Note: Make sure to replace <container_name>
and <image_name>
with the actual names you want to use.