theaveasso / docker-cs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-cs

What is Docker?

  • What is a container and what problems does it solve?
  • Container repository - Where do containers live
  • Before and After Container

What is Container?

  • What is a container?

Docker vs Virtual Machine

  • Difference between Docker and Virtual Machine
  • How to install docker-desktop on linux.ubuntu22.04

original post from docker documentation

  1. update the apt package index:
sudo apt-get update
  1. install packages to allow apt to use a repository over HTTPS
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
  1. adding docker's official GPG key
sudo mkdir -p /etc/apt/keyrings
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  1. setup the repository
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  1. list of available in the repo
apt-cache madison docker-ce
  1. install docker engine
sudo apt-get update
sudo apt install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin

Docker Commandline Interface CLI

Container management Commands

  • build an image
docker build [optins] .
  -t "app/container_name"
  • create the container
docker create [options] IMAGE
  -a, --attach                # attach stdout, stderr
  -i, --interactive           # attach stdin (interactive)
  -t, --tty                   # pseudo-tty
    , --name                  # name your image
  -p, --publish 5000:5000     # port map
    , --expose 5432           # expose a port to linked containers
  -P, --publish-all           # publish all port
    , --link container:alias  # linking
  -v, --volume pwd:/app     # mount (absolute paths needs)
  -e, --env NAME=hello        # env vars
  • run the container
docker run [options] IMAGE
  # see `docker create` for options
  • start the container
docker start [container ID or NAME]
  • stop the container
docker stop [container ID or NAME]
  • kill the container
docker kill [container ID or NAME]
  • suspend the container
docker pause [container ID or NAME]
  • resume the container
docker unpause [container ID or NAME]
  • destroy the container
docker rm -f [container ID or NAME]

Inspecting the Container

  • list running containers
docker ps
  • list all containers
docker ps -a
  • show the container output (stdout, stderr)

Debugging Container

About