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
- Make docker run by other user.
sudo usermod -aG yui
- View available commands.
docker
- View system-wide information about Docker.
docker info
- Download example images from Docker Hub.
docker run hello-world
- Pull an image from hub.
docker pull ubuntu
- List images downloaded.
docker images
- View Containers.
docker ps [-a all] [-l latest]
- Run a docker image, it will spawn a new one.
docker run -it ubuntu
- Delete a docker image.
docker rm adoring_jemison
- Start a docker image.
docker start docker_name
- Stop a docker image.
docker stop docker_name
- Enter a docker image.
docker exec -it docker_name /bin/bash
- Inspect settings.
docker inspect zcemycl/ubuntu-nodejs
- If docker config file docker-compose.yml exists, you can uninstall and clear memorys by,
docker-compose down -v
.
References
- How To Install and Use Docker on Ubuntu 16.04
- Install Docker Engine on Ubuntu
- How to Properly Use the GPU within a Docker Container
- Pushing and Pulling to and from Docker Hub
- DockerHub.com
- Docker Hub Quickstart
- How to Install Docker on Raspberry Pi
- docker rmi
- docker image build
- Docker run reference
- Stop / remove all Docker containers