This basic example tutorial will run an Ubuntu Docker container and the bash shell inside. To start with, run the docker run towards Ubuntu as shown here:
sudo docker run -it ubuntu /bin/bash
- sudo – if you are using a non-root user (which is recommended)
- the docker run command
- -it means to be interactive with tty
- Then the image name docker
- And the command you want to execute, in our case /bin/bash
Demo – docker run Ubuntu Bash shell
How to verify whether your docker Ubuntu container is running?
If you are inside the bash shell, as shown above, your container is running successfully.
Here is the command to check the container status from outside
sudo docker ps
dev@codetryout:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8ff384b268da ubuntu "/bin/bash" 9 minutes ago Up 9 minutes great_satoshi