Do It Yourself - Exercise
An exercise to test how well you understand Docker Swarm.
We'll cover the following
Finally, you are here! The journey to the Docker mastery will end soon and you will have Docker in your skill set along with its variations. The feeling of achievement must be awesome. You should definitely feel proud as you put all efforts into learning a new skill that increases your ability to work with containerized product environments.
This exercise will not push your mind to think more and with your current knowledge, you will be able to solve this smoothly and easily.
Problem statement#
In this exercise, you will troubleshoot the issues in the existing environment and make it working again.
This exercise is mainly focused on your understanding of the different components and architecture of Docker and Docker Swarm. So, if your core concepts are clear, then solving this exercise will be a piece of cake.
So, let’s have a look at the code.
Change app.config[‘MYSQL_HOST’] = ‘database’ in
app.py line 10
. Because links are not supported in docker stacks and services are identified with their service name mentioned in thedocker-compose.yml
file.
If your changes are not reflected in the terminal after making changes to files then consider restarting the terminal. To restart the terminal follow the below steps:
- Type
docker stop educative
. This command will disconnect the current terminal.
root@educative:/exercise_4# docker stop educative
Terminal Disconnected: Run again to reconnect.
- Click on the “Run” button again.
This should solve the problem.
/
- app.py
You should be able to see something on this screen if you are running this using the Educative app link like, ‘Your app can be found at: https://6ej7y5xww2n49.educative.run’.
If you are running this exercise on your machine, you should get this screen on localhost:8080. This is the swarm visualizer and you will be able to see all the running containers here. There should be a total of six containers/tasks running or whatever replicas you mention in the compose-file.