Syntax
docker run
imageName:tagName
Whenever
you ran above command, docker starts new container with given image.
For
example, Start new container with jboss/wildfly image by executing below
command.
docker run
-d -p1234:8080 jboss/wildfly
$docker run -d -p1234:8080 jboss/wildfly Unable to find image 'jboss/wildfly:latest' locally latest: Pulling from jboss/wildfly a02a4930cb5d: Pull complete b5ffff9dbcda: Pull complete 36845d6d0218: Pull complete 08619c8c88e2: Pull complete 6292a0d81fc0: Pull complete Digest: sha256:d538754ee178cd3f8e954d9e093e81ce5b0dfa0ef56919fcab50c1f932ee594e Status: Downloaded newer image for jboss/wildfly:latest 94c40efb9fcb969f819cb86cd58356f1658717e5e61f1009f918c5e8b8e4bee2 $ $ $docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 94c40efb9fcb jboss/wildfly "/opt/jboss/wildfly/…" 12 seconds ago Up 11 seconds 0.0.0.0:1234->8080/tcp upbeat_mendeleev Lets start another container with the same image by running below command. docker run -d -P jboss/wildfly $docker run -d -P jboss/wildfly 3c7b2ff5c0c8274312f2eb18095e6f3c668084e11848a88f41661db94d65d4a0 $ $docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3c7b2ff5c0c8 jboss/wildfly "/opt/jboss/wildfly/…" 3 seconds ago Up 3 seconds 0.0.0.0:32769->8080/tcp thirsty_matsumoto 94c40efb9fcb jboss/wildfly "/opt/jboss/wildfly/…" About a minute ago Up About a minute 0.0.0.0:1234->8080/tcp upbeat_mendeleev
As you see
the output of ‘docker ps’ command, it shows that there are two containers
running.
No comments:
Post a Comment