docker ce on Ubuntu

 

Note:

# - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

 

 

1. install

$sudo apt install docker.io

 

2. enable

$ sudo systemctl start docker
$ sudo systemctl enable docker

 

 test:

$ docker --version

 

 

 

 二、Docker compose

1. down

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 

2. exec

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

 

test

tdtc@tdtc306:~$ docker-compose --version
docker-compose version 1.24.1, build 4667896b

 

 三、other command

 

    1. 清理image

sudo docker system prune -a

 

    2. 管理image

1)ps

sudo dokcer ps

2)进入container

fat shell:

sudo docker exec -it <mycontainer-names> bash

simple shell:

sudo docker exec -it <mycontainer-names> sh

 

 

3)container内执行

    查看

cat Gopkg.toml |more

    编辑

apt-get update
apt-get install vim -y vi Gopkg.toml

 

 4) stop all containers

sudo docker stop $(sudo docker ps -q)

 

 

 

Reference:

    1. How to Install Docker On Ubuntu 18.04 Bionic Beaver

    2. Install Docker Compose(Offical)

    3. How do I get into a Docker container‘s shell?

 

docker ce on Ubuntu

上一篇:Ubuntu下开启/关闭防火墙及端口


下一篇:macos dmg 转 cdr