Ubuntu 19.04
Sponsored Link

Docker : Access to Container Services2019/04/25

If you'd like to access to services like HTTP or SSH which is running in Containers as a daemon, Configure like follows.
[1] For exmaple, use a Container which has Apache2.
# start the Container and also run Apache2

# map the port of Host and the port of Container with [-p xxx:xxx]

docker run -t -d -p 8081:80 srv.world/ubuntu_apache2 /usr/sbin/apachectl -D FOREGROUND


docker ps

CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                  NAMES
38ae5c950273        srv.world/ubuntu_apache2   "/usr/sbin/apachectl…"   22 seconds ago      Up 21 seconds>80/tcp   determined_bose

# create a test page

docker exec 38ae5c950273 /bin/bash -c 'echo "Apache2 on Docker Container" > /var/www/html/index.html'
# verify it works normally

curl localhost:8081

Apache2 on Docker Container
Matched Content