FreeKB - docker run command
docker run command

Home > Search

This assumes you have installed Docker on Linux and Docker is running. The docker run command is used to run a command against a container. It's also important to recognize that if there is no container for the application being run, the image will be pulled down and the container will be created. For this reason, before issuing the docker run command, you'll want to use the docker images command to return the list of images, like this.

docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
foo                 latest              105b54dc64f1        32 hours ago        196.7 MB

 

And the docker ps command to list the containers.

docker ps -a

CONTAINER ID     IMAGE              COMMAND                 CREATED       STATUS        PORTS     NAMES
d937372c09ab9    b939aa938add9913   "/docker-entrypoin..."  6 minutes ago Up 30 seconds 0.0.0.0:12345->12345/tcp

 

In this example, the docker run command is used to perform a SQL database migration.

docker run my-container migrations

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 2c151 in the box below so that we can be sure you are a human.




Comments