Troubleshooting Steps - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
The way I went about completing this project, created lots of troubleshooting issues. I initially installed both the nginx and firefly containers separately. I made sure each one could run in my browser separately. When it was time to combine them into one docker-compose.yml file, I had to move some things and add certain things to get everything working. Below are the troubleshooting issues that I had!
Port 80 already in use
Due to a prior lab where we set up dockerized wordpress, port 80 was already being used to load wordpress. All I had to do to fix this error was stop the wordpress docker container.
sudo docker-compose down
Multiple Directories/docker-compose.yml files
At first I created a firefly
directory and a nginx
directory under the DockerProject
directory. I made a docker-compose.yml file in each directory and copied the yml data as instructed, into each file to get the services running. Doing this allowed both services to run separately, but made it harder to incorperate them into one file. To fix this I had to
- move the docker-compose.yml file and the other files up a directory from firefly to DockerProject with
mv docker-compose.yml ../
- delete the
firefly
directory I made - delete the docker-compose.yml file in nginx
Removing containers
Before I started changing and moving around containers, I forgot to stop the containers. So once I changed thing around and tried to start the containers again, I couldn't because there were containers with the same ones that I was trying to create already running. If you look at the error below, you will see what I am talking about.
To fix this I used the command sudo docker stop <container_name>
and you can see the container names with docker ps
Then after that if you want to rebuilt the containers from scratch instead of just starting them again you can do that command docker-compose build --no-cache
default.conf vs nginx.conf
In my Dockerfile
I originally had my conf file as default.conf from the tutorial I was following. It should have been nginx.conf. I made the nginx.conf file but forgot to switch it in the Dockerfile, so it wasn't able to find the file for a while.
Name of container
In the /nginx/nginx.conf file I needed to put the name of the container. I had to find this and it turned out it was app
. I found this in the docker-compose.yml
file.
image: nginx vs build: ./nginx
When I was editing the docker-compose.yml file I changed the nginx part from build: ./nginx to image: nginx, which prevented it from working
This is the correct way it should have been written
nginx name override
After everything was seemingly fixed, the nginx browser was still overriding the firefly broswer. Turns out that the system was building the container with the name nginx
with some of the configurations from before we change everything. I found that changing the name of the the nginx
section fixed the issue.
Here is what I changed it to, and once I did the system built a new container with this name instead of nginx
. Once I did this, the problem was fixed.