Managing containers

Let's try to run the Tomcat container as a background process.

  1. It is best practice to run a Docker container as a background process to avoid accidentally stopping containers from the terminal:
  2. Use the -d parameter:
                [root@localhost Desktop]# docker run -d tomcat
                68c6d1f7bc631613813ffb761cc833156a70e2063c2a743dd2729fe73b2873f9
    
  3. Verify the container you just created:
                [root@localhost Desktop]# docker ps
                CONTAINER ID        IMAGE               COMMAND             CREATED                             STATUS              PORTS               NAMES
                68c6d1f7bc63        tomcat              "catalina.sh run"   15                         seconds ago      Up 11 seconds       8080/tcp                                    desperate_hypatia   
                You have new mail in /var/spool/mail/root
    
  4. Get the IP address of the ...

Get DevOps for Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.