Skip to content

Docker commands

Adam Vlček edited this page Apr 12, 2025 · 1 revision

Docker compose

Docker compose enables quick deployment multi-container enviroments with one command. The docker compose command can also be docker-compose depending on your installation.

Docker compose:

Notes

  • Docker compose commands have to be executed in the root direcotory
  • For the database-releated functionality to work properly you need to manually create aa .env file with enviromental variables ie: here.

Commands

  • docker compose up - starts all docker containers interactivelly (in the current cli)
  • docker compose up -d - starts docker in backgroud (detached)
  • docker compose down - stops all containers started by the command above

Universal commands

  • docker system prune --all --volumes --force - clears docker images, conainers, cache and volumes
  • docker system prune - clears all unused docker resources

Docker commands [Deprecated]

<image_name> a <container_name> are only for identification meaning that it is very much up to you to name them, it simply does't matter.

  • build: docker build -t <image_name> .
  • build with a decrypt key: docker build --build-arg DECRYPT_KEY=<DECRYPT_KEY> -t <image_name> .
  • run: docker run -d -p 8080:80 -p 3000:3000 --name <container_name> <image_name>
  • ssh: docker exec -it <container_name> /bin/bash
  • stop: docker stop <container_name>
  • delete container: docker rm <container_name>
  • delete image: docker rmi <image_name>
  • automatically clear docker of anything not currently in use: docker system prune
  • clear everthing: docker system prune --all --volumes --force

Clone this wiki locally