There is simply an ubuntu server with docker installed. Pulling wordpress docker image using
`$ docker pull wordpress`.
Then running the container using
$ docker run --name my-wp -p 8080 -h 192.168.1.11 -d wordpress
Checking the logs:
$ docker logs my-wp
WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
[Mon Mar 30 10:42:10.499346 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38
(Debian) PHP/7.3.16 configured -- resuming normal operations
[Mon Mar 30 10:42:10.499390 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D
FOREGROUND'
Checking running container and port number:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9a06a4bb7ce5 wordpress "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 80/tcp, 0.0.0.0:32769->8080/tcp my-wp
Now I tried to access wordpress using ip 192.168.1.11:8080 and 192.168.1.11:32769 and 127.0.0.1:8080 and 127.0.0.1:32769. None could open the wordpress page. Note that I already have a webserver running on port 80 on my host OS.
Any ideas on how to access wordpress web page?
Thanks to David Maze, whose comment helped to realise that port remapping is necessary. With the following command, I map port 80 of the container to port 8080 of the host, and now wordpress is accessible.
$ docker run --name my-wp -p 8080:80 -d wordpress