Why apache container is not running?

Hi @player001 @juliettet @akshayyw
I’ve created a compose file to start two containers named web and DB
But apache container is not running!


It exited with status code 0 too.

Hi @Ashu27,

It looks to me like you may have an incorrect image name in your compose file. Try something more like this (…or you could also use any available apache tag):

php:rc-apache

Also, even though it is not expressly stated as part of this task, consider adding and overlay network to both of your services so that the two containers can speak to one another:

services:
    web:
      image: php:rc-apache
      .......
      .........
      ...etc...
      networks:
            - overlay
      db:
      image: .....
      .......
      .........
      ...etc...
      networks:
            - overlay

networks:
    overlay:

I hope that this helps:-)

HI @juliettet,
With overlay too, I still need the ports right?

1 Like

Yes,

  • Map php_apache container’s port 80 with host port 8083

  • &

  • Map mysql_apache container’s port 3306 with host port 3306

In order to view/access the containers, they need to be exposed.

I hope this helps:-)

PS.

  • a note on ports:

ports :

  1. Activates the container to listen for specified port(s) from the world outside of the docker(can be same host machine or a different machine) AND also accessible world inside docker.
  2. More than one port can be specified (that’s is why ports not port)

Hi @juliettet
Thanks for the help.
I’ve changed the image name of the apache container and everything worked.
I haven’t used overlay networks in compose file.
The task is successfull.

2 Likes

Hi @Ashu27,

Awesome! Great job!

1 Like