Deploying containers in a swarm environment: Container Information

More manuals

Container Information

First of all, we will run “docker container ls” command to list all containers:

root@server:# docker container ls

CONTAINER ID        IMAGE COMMAND                  CREATED STATUS PORTS                       NAMES

c688d950aa75        php:7.0-apache "docker-php-entrypoi…"   12 days ago Up 12 days 0.0.0.0:8600->80/tcp        perceval-httpd

5f7f1b1c5461        php:7.0-apache "docker-php-entrypoi…"   13 days ago Up 13 days 0.0.0.0:8300->80/tcp        sep_content_eval-httpd

6c87f622280d        ce-api_api "npm start"              7 weeks ago Up 7 weeks 80/tcp, 0.0.0.0:4000        ce-api_api_1_955aa538ade9

46f30529d0f7        ce-api_neo4j "/sbin/tini -g -- /d…"   7 weeks ago Up 7 weeks 0.0.0.0:7474->7474/t7/tcp   ce-api_neo4j_1_fac2975ed269

79fe3b95821d        php:7.0-apache "docker-php-entrypoi…"   2 months ago Up 2 months 0.0.0.0:8200->80/tcp        syntheval-httpd

03a12c3aec19        php:7.0-apache "docker-php-entrypoi…"   2 months ago Up 2 months 0.0.0.0:8100->80/tcp        beaqlejs-httpd

Use the container ID, and run “docker inspect c688d950aa75” command to show all information related to this container:

root@server:# docker inspect c688d950aa75

[

    {

        "Id": "c688d950aa751ac6d116c0b3052f556ace31378898f3ca3639ed5e3cfcd5c0ef",

        "Created": "2019-10-16T15:42:29.594620204Z",

        "Path": "docker-php-entrypoint",

        "Args": [

            "apache2-foreground"

        ],

        "State": {

            "Status": "running",

...]

The most relevant information provided will be:

Which port is used:

            "PortBindings": {

                "80/tcp": [

                    {

                        "HostIp": "",

                        "HostPort": "8600"

                    }

                ]

            },

 

Where data is located:

        "Mounts": [

            {

                "Type": "bind",

                "Source": "/home/lab/myapp",

                "Destination": "/var/www/html",

                "Mode": "rw",

                "RW": true,

                "Propagation": "rprivate"

            }

It is essential searching the “docker-compose.yml” file, we can find it with “ locate docker-compose.yml” command:

root@server:# locate docker-compose.yml

/home/lab/myapp/tools/Docker/docker-compose.yml

In “docker-compose.yml” file is specified which image is used:

version: "2"

services:

  httpd:

    image: php:7.0-apache

    container_name: myapp-httpd

    ports:

      - "8600:80"

    volumes:

      - ../../:/var/www/html