1. Home
  2. Docker
  3. Docker Commands
  4. Docker – run

Docker run command

Use Docker run command to launch containers from an image. It provides a large number of options.

Syntax

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Example

For example, run the hello-world example officially provided by Docker community to test your installation. Run command will also download the image from docker hub it not found locally.

$ sudo docker run hello-world

As a better use, you can use -i to keep STDIN open and -t to allocate a TTY to the container. You can also use -d to run container in detached (background) mode. I have also run bash shell as a startup script to the container.

$ sudo docker run -it -d ubuntu /bin/bash
Tags , ,
Was this article helpful to you? Yes No