docker(ce) on Ubuntu

 

Note:linux

# - 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. installgit

$sudo apt install docker.io

 

2. enablegithub

$ sudo systemctl start docker
$ sudo systemctl enable docker

 

 test:docker

$ docker --version

 

 

 

 2、Docker compose

1. downshell

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. execubuntu

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

 

testvim

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

 

 3、other command

 

    1. 清理imagebash

sudo docker system prune -a

 

    2. 管理imagecurl

1)psionic

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?

相關文章
相關標籤/搜索