Saturday 9 May 2020

docker: create, start: Create and start the container

'docker create' command is used to create a container, once the container is created, you can start the container using 'docker start' command.

Step 1: Execute the below command to create a container
docker create -p1234:8080 jboss/wildfly

$docker create -p1234:8080 jboss/wildfly
a523924b741accfb04a72d6322c6197c50b4be0b175b8a2d9e087d22d20a1786
$
$docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                           PORTS               NAMES
a523924b741a        jboss/wildfly       "/opt/jboss/wildfly/…"   3 seconds ago       Created                                              silly_cori

From the output, you can observe that container is created with id 'a523924b741a'.

Step 2: Start the container using 'docker start' command.
$docker start a523924b741a
a523924b741a

open the url 'http://localhost:1234/', you can able to see WildFly server home page.


You can even execute the command 'docker ps -a' to check whether container started or not.
$docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                           PORTS                    NAMES
a523924b741a        jboss/wildfly       "/opt/jboss/wildfly/…"   About a minute ago   Up 50 seconds                    0.0.0.0:1234->8080/tcp   silly_cori



Previous                                                    Next                                                    Home

No comments:

Post a Comment