(Please feel free to update it with anything you might consider)
This post is based on the post https://www.edwinology.com/2020/05/trying-out-docker-with-magnolia-cms.html thanks to our dear friend Edwin.
(Download the attached Dockerfile and move into the directory that contains the file)
These are the list of commands I have used so far:
[OPTIONAL]
0) get familiar with Docker commands:
sudo docker --help
1) Build author and public images:
sudo docker build -t magnolia_author --build-arg MGNL_AUTHOR=true .
sudo docker build -t magnolia_public --build-arg MGNL_AUTHOR=false .
1.1) Verify that images were succesfully built:
sudo docker images
2) Create a network:
sudo docker network create --subnet=192.168.42.0/24 mgnlnet
2.1) Verify the network exists:
sudo network ls
3) Create instances (author and public) from the previous built images (the -v flag creates a bind container = shared resource between your machine and the container, its usage syntax would be the following: "-v PATH_OF_YOUR_MACHINE:PATH_OF_CONTAINER"), you will need to change the first path(/home/magnolia/IdeaProjects/6.2.19/light-modules/) of the -v before the ":", but not the second one (/opt/magnolia/light-modules)
sudo docker run -v /home/magnolia/IdeaProjects/6.2.19/light-modules/:/opt/magnolia/light-modules --rm -d -p 8080:8080/tcp --network mgnlnet --name mgnlauthor magnolia_author
sudo docker run --rm -d -p 8090:8080/tcp -v /home/magnolia/IdeaProjects/6.2.19/light-modules/:/opt/magnolia/light-modules
--network mgnlnet --name mgnlpublic magnolia_public
3.1) Verify the containers are up and running:
sudo docker ps
4) Access localhost:8080 (author) and localhost:8090(public) successfully:
Go to http://localhost:8080/.magnolia/admincentral and http://localhost:8090/.magnolia/admincentral
5) In order to being able to publish from the author to the public we need to change the public receiver configuration (I WAS NOT ABLE TO):
* publishing-core
* config
* receivers
* mgnlpublic
url: http://mgnlpublic:8080
Some other [OPTIONAL] useful commands
[OPTIONAL]
sudo docker exec -it CONTAINER_ID /bin/sh => Enter into a container
=> then go to "cd /opt/tomcat/logs" to see the logs
[OPTIONAL]
sudo docker system prune -a => clean Docker