Getting Started w/ Docker

Docker containers can help approach server infrastructure into the IAC framework. This can help with software development, prototyping and Enterprise Scalability.

Docker Debian Install script:

# Docker's Convenience Script > Debian
$ curl -fsSL -o
$ sudo sh

Docker Manual Linux Install:

$ sudo apt update
$ sudo apt-get install ca-certificates curl gnupg lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli docker-compose docker-compose-plugin
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ sudo systemctl enable docker.service
$ sudo systemctl start docker.service
# Install docker compose plugin
$ sudo apt-get install docker-compose-plugin
# Verify docker-compose plugin
$ docker compose version
# May have to logout and back in to avoid docker error.

Docker Portainer Install:

$ git clone
$ cd docker/portainer
$ docker-compose up -d 
# https://ip-of-server:9443
# setup admin account 
# You can now manage docker using Portainer. 

Docker Basic Commands:

# run A container example
$ docker run -d --name nginx -p 443:443 nginx:latest
# Search a container - Example
$ docker search nginx
# Download the container
$ docker pull nginx
# See Running Containers
$ docker ps
# See All Containers
$ docker ps -a
# See All images
$ docker images
# Manage Containers
$ docker stop CONTAINER_ID
$ docker start CONTAINER_ID
$ docker rm CONTAINER_ID
# Enter docker bash shell
$ docker exec -it ContainerName bash
# Execute docker command from terminal
$ docker exec -it ContainerName Command

Docker Compose Basic Commands:

# The old way to run docker compose 
$ docker-compose up -d
# Docker Plugin uses docker compose instead of docker-compose
$ docker compose build      Build or rebuild services
$ docker compose convert    Converts the compose file to platform’s canonical format
$ docker compose cp         Copy files/folders between a service container and the local filesystem
$ docker compose create     Creates containers for a service.
$ docker compose down       Stop and remove containers, networks
$ docker compose events     Receive real time events from containers.
$ docker compose exec       Execute a command in a running container.
$ docker compose images     List images used by the created containers
$ docker compose kill       Force stop service containers.
$ docker compose logs       View output from containers
$ docker compose ls         List running compose projects
$ docker compose pause      Pause services
$ docker compose port       Print the public port for a port binding.
$ docker compose ps         List containers
$ docker compose pull       Pull service images
$ docker compose push       Push service images
$ docker compose restart    Restart service containers
$ docker compose rm         Removes stopped service containers
$ docker compose run        Run a one-off command on a service.
$ docker compose start      Start services
$ docker compose stop       Stop services
$ docker compose top        Display the running processes
$ docker compose unpause    Unpause services
$ docker compose up         Create and start containers
$ docker compose version    Show the Docker Compose version information