8
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                     PORTS                    NAMES
ca030d3cf1c2        konakart_app                 "/bin/sh -c '/bin/bas"   16 minutes ago      Exited (1) 5 minutes ago                            konakart_app
08909245064b        beantoast/dtkonakart_mysql   "/entrypoint.sh mysql"   54 minutes ago      Up 54 minutes              0.0.0.0:3300->3306/tcp   konakart_db

I'm trying to run konakart app and it's database in two different containers. The database seems to be working fine, but the application itself seems to have no IP. When I type in docker inspect ca03 I get the following:

            "EndpointID": "",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "",
        "IPPrefixLen": 0,
        "IPv6Gateway": "",
        "MacAddress": "",

Any idea of how to assign a my IP address, port 8080 to the konakart_app?

naimdjon
  • 3,162
  • 1
  • 20
  • 41
Miguel Xoel Garcia
  • 307
  • 1
  • 4
  • 18

2 Answers2

9

The reason is simple based on the output of docker ps -a result that you posted in the top.

You might have noticed that it is showing status Exited (1) 5 minutes ago for the container whose id is ca030d3cf1c2. That means, container is stopped.

Once container is stopped, it will not have any IPAddress. That's the reason being shown empty in the result of docker inspect ca03 which you posted.

Start the container, you would get the IPAddress.

To your last question, you may have that configuration for port forwarding using your docker-compose.yml file. Or you may also do it while running docker run using -p <hostport>:<container port> option.

Hope this is helpful.

Rao
  • 20,781
  • 11
  • 57
  • 77
0

The cause for a container not to have an IPAddress as mention in Rao's answer can be, that the container is exited. A possible reason for this can be, that you don't have space let on your device, if nothing else changed.

Zelphir Kaltstahl
  • 5,722
  • 10
  • 57
  • 86