|
| 1 | +### Docker-Compose instead of Docker Compose |
| 2 | + |
| 3 | +If you are using `docker-compose` instead of `docker compose` (note the " " |
| 4 | +instead of the "-"), you should update your docker cli to the latest version. |
| 5 | +`docker compose` is the most recent version and should be used instead of |
| 6 | +`docker-compose` |
| 7 | + |
| 8 | +For more details and information check out |
| 9 | +[this SO thread](https://stackoverflow.com/questions/66514436/difference-between-docker-compose-and-docker-compose) |
| 10 | +that explains it all in detail. |
| 11 | + |
| 12 | +### Pre-commit |
| 13 | + |
| 14 | +We are using pre-commit to ensure the quality of the code as well as the same |
| 15 | +code standard. |
| 16 | + |
| 17 | +The steps that you need to follow to be able to use it are: |
| 18 | + |
| 19 | +```bash |
| 20 | + # install pre-commit in your python environment |
| 21 | + pip3 install pre-commit |
| 22 | + |
| 23 | + # install pre-commit in your github configuration |
| 24 | + pre-commit install |
| 25 | +``` |
| 26 | + |
| 27 | +So from now on, in your next commits it will run the `pre-commit` on the files |
| 28 | +that have been staged. If there has been any error, you will need to solve that, |
| 29 | +and then stage+commit again the changes. |
| 30 | + |
| 31 | +## Docker Cannot Start Container: Permission Denied |
| 32 | + |
| 33 | +Instead of running docker with the root command always, you could create a |
| 34 | +`docker` group with granted permissions (root): |
| 35 | + |
| 36 | +```bash |
| 37 | + # Create new linux user |
| 38 | + sudo groupadd docker |
| 39 | + |
| 40 | + # Add the actual user to the group |
| 41 | + sudo usermod -aG docker $USER |
| 42 | + |
| 43 | + # Log in the group (apply the group changes to actual terminal session) |
| 44 | + newgrp docker |
| 45 | +``` |
| 46 | + |
| 47 | +After that, you should be able to run docker: `docker run .`. In the case you |
| 48 | +still are not able, can try to reboot terminal: |
| 49 | + |
| 50 | +```bash |
| 51 | + reboot |
| 52 | +``` |
| 53 | + |
| 54 | +### Docker Cannot Stop Container |
| 55 | + |
| 56 | +If you try to shut down the services (`docker-compose down`), and you are |
| 57 | +getting permission denied (using root user), you can try the following: |
| 58 | + |
| 59 | +```bash |
| 60 | + # Restart docker daemon |
| 61 | + sudo systemctl restart docker.socket docker.service |
| 62 | + |
| 63 | + # And remove the container |
| 64 | + docker rm -f <container id> |
| 65 | +``` |
0 commit comments