Going further: Docker options, debugging and managing ressources

  1. Check logs and debug

If your container restarts all the time, you can check the logs:

sudo docker logs traefik

  It will give you the end of the logs. To define how much of the logs to see, option --tail can be used:

sudo docker logs traefik -f --tail 1000

  Or if you want to follow the logs as you are using the application

sudo docker logs traefik -f

This is particularly usefull when debuging a specific page loading issue.   To check all the log options, you can run:

docker logs --help

  Depending on the errors observed, you will need to either:

  • correct your docker-compose.yml file
  • review your network/database connectivity

 

  • Accessing the content of the container

Once connected to the Traefik container host, you can log in the container but executing the command:

sudo docker exec -it traefik ash

 

This can be needed when checking the volumes & files configurations.

 

  • Example of certificate generation failure due to file permission issues

The Traefik container rarely fails as a service but certificate retrieval and renewal can fail. Unable to add ACME provider to the providers list: unable to get ACME account: permissions 755 for /letsencrypt/acme.json are too open, please use 600

 
The solution is simple:
sudo chmod 600 acme.json
sudo docker restart traefik2 
 
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x