Debian 10 Buster
Sponsored Link

Docker : Access to Container Services2019/07/24

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 /usr/sbin/apachectl -D FOREGROUND


docker ps

CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                  NAMES
a59a297105ac   "/usr/sbin/apachectl…"   27 seconds ago      Up 25 seconds>80/tcp   laughing_pike

# create a test page

docker exec a59a297105ac /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