Docker


Installation


sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
lsb_release -cs # bionic
uname -m # x86_64 so use amd64
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
    

Basic Operations

  1. Make docker run by other user. sudo usermod -aG yui
  2. View available commands. docker
  3. View system-wide information about Docker. docker info
  4. Download example images from Docker Hub. docker run hello-world
  5. Pull an image from hub. docker pull ubuntu
  6. List images downloaded. docker images
  7. View Containers. docker ps [-a all] [-l latest]
  8. Run a docker image, it will spawn a new one.docker run -it ubuntu
  9. Delete a docker image. docker rm adoring_jemison
  10. Start a docker image. docker start docker_name
  11. Stop a docker image. docker stop docker_name
  12. Enter a docker image. docker exec -it docker_name /bin/bash
  13. Inspect settings.docker inspect zcemycl/ubuntu-nodejs
  14. If docker config file docker-compose.yml exists, you can uninstall and clear memorys by, docker-compose down -v.

References


  1. How To Install and Use Docker on Ubuntu 16.04
  2. Install Docker Engine on Ubuntu
  3. How to Properly Use the GPU within a Docker Container
  4. Pushing and Pulling to and from Docker Hub
  5. DockerHub.com
  6. Docker Hub Quickstart
  7. How to Install Docker on Raspberry Pi
  8. docker rmi
  9. docker image build
  10. Docker run reference
  11. Stop / remove all Docker containers