Docker: 安装部署

Docker

  • Docker
  • Docker-compose

installation

Part1: docker

// Required dependencies
sudo apt update && sudo apt upgrade
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

// Install GPG CA
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

// Write software source information
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

// Update and install Docker-CE
sudo apt -y update && sudo apt -y install docker-ce

// Check version
docker version

Part2: docker-compose

// Install composer
sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

// permission
sudo chmod +x /usr/local/bin/docker-compose

// check version
docker-compose --version

User Config

Warinning INFOS:
version: dial unix /var/run/docker.sock: connect: permission denied

SOLVES:
// Create the docker group.
sudo groupadd docker
// Add your user to the docker group.
sudo usermod -aG docker ${USER}
// Add auth
sudo chmod 666 /var/run/docker.sock

Remove Docker

// Stop all containers and objects
docker container stop $(docker container ls -aq)
docker system prune -a --volumes

// apt remove
sudo apt purge docker-ce
sudo apt autoremove

getting start

hello world

// pull hello-world image and run test
docker image pull hello-world
docker image ls
docker container run hello-world

container operation

// running image
docker ps -a

// show all image
docker image ls

// stop container
docker container kill [containID]

// remove container
docker container rm [containID]

reference

Docker docs:
https://docs.docker.com/

Installation:
https://docs.docker.com/engine/install/ubuntu/

Image manage with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

posted @ 2020-11-24 16:42  kumata  阅读(145)  评论(0编辑  收藏  举报