1

I'm getting started with AWS ECS and, as a proof of concept, I'm trying to run a simple Apache webserver. The problem is that the task fails, shutting down with the message:

Essential container in task exited

The container in my task pulls a Docker Hub image I built myself from this dockerfile:

FROM ubuntu:16.04

RUN apt update
RUN apt install -y apache2
RUN echo "Welcome to my web site" > /var/www/html/index.html
EXPOSE 80

I know that the pull was successful, that the image can do what it's supposed to do, and my networking is all good because, when I run this from the command line on the underlying EC2 instance:

docker run -d -p 80:80 reponame/webserver /usr/sbin/apache2ctl -D FOREGROUND

...it gives me a working web page. I gave the container a hard limit of 512 MB and port mappings from 80 to 80. It's tagged "essential" and I've tried using all kinds of values for Entry point, including:

/usr/sbin/apache2ctl -D FOREGROUND

Any ideas? Thanks,

dlanced
  • 227
  • 1
  • 4
  • 12

1 Answers1

2

I gave up and decided instead to add the apachectl command and its arguments to the dockerfile:

CMD /usr/sbin/apache2ctl -D FOREGROUND

I then rebuilt the image and pushed it again. That way, there was no need to pass anything into the container through the task definition at runtime.

dlanced
  • 227
  • 1
  • 4
  • 12