Skip to content

Instantly share code, notes, and snippets.

@josephgoksu
Last active July 18, 2022 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephgoksu/1a389411db5e490dc7c482b22e9e0ae2 to your computer and use it in GitHub Desktop.
Save josephgoksu/1a389411db5e490dc7c482b22e9e0ae2 to your computer and use it in GitHub Desktop.
Cheatsheet for docker

Configure Docker to start on boot

Most current Linux distributions (RHEL, CentOS, Fedora, Debian, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. On Debian and Ubuntu, the Docker service is configured to start on boot by default. To automatically start Docker and Containerd on boot for other distros, use the commands below:

 sudo systemctl enable docker.service

 sudo systemctl enable containerd.service

To disable this behavior, use disable instead.

 sudo systemctl disable docker.service

 sudo systemctl disable containerd.service

If you need to add an HTTP Proxy, set a different directory or partition for the Docker runtime files, or make other customizations, see customize your systemd Docker daemon options.

Execute commands in a docker container

docker run -it <image name> <command>

Execute commands in a docker container using docker-compose

docker-compose -p CONTAINER_NAME exec app /usr/local/bin/entrypoint.sh run_command <command>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment