-
Notifications
You must be signed in to change notification settings - Fork 0
Docker cheat sheet
We recommend to consider taking the course DevOps with Docker.
Install Docker Engine and Docker Compose according to the instructions.
Here are useful commands gathered that are essential when working with the project.
See that docker and docker-compose might require sudo rights. Luckily this isn't the case in the ohtup-staging but propably on your own machine. One possible solution is in here.
Run the program:
docker-compose up
Run the program taking concern possible modifications.
docker-compose up --build
Shut down the program:
docker-compose down
Listing the containers ('a' indicates that show even stopped ones):
docker container ls -a
More about Testing.
Run the unit tests:
docker-compose run qleader-web py.test
The code coverage can be generated by:
docker-compose run qleader-web coverage run -m pytest
Saving the coverage results can be done like this:
docker-compose run qleader-web coverage <option> (e.g. "xml" / "json" / "html" ... more options with "--help")
Here are the commands in the right order to be done in the staging, if there are changes that require more than Watchtower's restarting actions:
-
Stopping the project (in the project folder with the docker-compose.yml -file):
docker-compose down -
Listing running containers (perhaps want to see what's the names of the containers):
docker container lsTo see all the containers, even the stopped ones, add the flag -a.
-
Removing container (removing your project's old containers might be needed when creating new ones):
docker container rm qleader-db # Here is an example so replace the container name "qleader-db" with correct one!- See that the container is stopped before trying to remove it. For this there are more options like stop and kill (or docker-compose down, if you are in the project folder) depending on the situation.
-
Building project (in the beginning or if there are some bigger changes, for example, changes in the database)
docker-compose up --build -d -
Restarting (in the folder /nginx):
docker-compose restartCan also be done in the /qleader if needed.