Docker is a new technology that allows development teams to build, manage, and secure apps anywhere. Docker is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates application deployment on the container.
Here are my simplest steps to install Docker and Docker Compose into Ubuntu 18.04 and 16.04.
Install Docker and Compose into Ubuntu 18.04
Just one command:
snap install docker
root@ubuntu18-04-1:~# snap install docker docker 18.09.9 from Canonical✓ installed
It will also install docker-compose. If your Ubuntu 18.04 notifies you do not have snap, you can install it with following command:
apt install snap
root@ubuntu18-04-1:~# docker version Client: Version: 18.09.9 API version: 1.39 Go version: go1.13.4 Git commit: 1752eb3 Built: Sat Nov 16 01:05:26 2019 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 18.09.9 API version: 1.39 (minimum version 1.12) Go version: go1.13.4 Git commit: 9552f2b Built: Sat Nov 16 01:07:48 2019 OS/Arch: linux/amd64 Experimental: false root@ubuntu18-04-1:~# docker-compose version docker-compose version 1.23.2, build unknown docker-py version: 3.7.3 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 root@ubuntu18-04-1:~#
root@ubuntu18-04-1:~# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:9572f7cdcee8591948c2963463447a53466950b3fc15a247fcad1917ca215a2f Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ root@ubuntu18-04-1:~# root@ubuntu18-04-1:~# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest fce289e99eb9 13 months ago 1.84kB root@ubuntu18-04-1:~#
Install Docker and Compose into Ubuntu 16.04
For Ubuntu 16.04, you will need six commands to install Docker:
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
sudo apt update
sudo apt -y install docker-ce
For Docker-Compose, you will either using following command to take it longer :
apt install docker-compose
Or you can use following two commands to get it done faster:
curl -L “https://github.com/docker/compose/releases/download/1.19.0/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
You can test your first example docker hello-world with following command:
docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
root@ubuntu16-04-1:~# docker --version Docker version 18.09.9, build 1752eb3 root@ubuntu16-04-1:~# docker-compose --version docker-compose version 1.23.2, build unknown root@ubuntu16-04-1:~#
Docker Image : Speedtest-cli
root@ubuntu18-04-1:~# docker run --rm moutten/speedtest-cli
Unable to find image 'moutten/speedtest-cli:latest' locally
latest: Pulling from moutten/speedtest-cli
3690ec4760f9: Pull complete
8cf4eb2be1b3: Pull complete
b30d63227d13: Pull complete
6255aad43ec4: Pull complete
Digest: sha256:feacde601da0c9e06989c900a21e86105c7af327382444b989eeb3a36c06865c
Status: Downloaded newer image for moutten/speedtest-cli:latest
Retrieving speedtest.net configuration...
Testing from Google Cloud (35.225.54.226)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cox - Nova (Fairfax, VA) [21.49 km]: 35.428 ms
Testing download speed................................................................................
Download: 695.30 Mbit/s
Testing upload speedTraceback (most recent call last):
File "/usr/local/bin/speedtest-cli", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1400, in main
shell()
File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1376, in shell
speedtest.upload(callback=callback)
File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 1086, in upload
data._create_data()
File "/usr/local/lib/python2.7/site-packages/speedtest.py", line 497, in _create_data
(chars * multiplier)[0:int(self.length) - 9]
MemoryError
root@ubuntu18-04-1:~#
root@ubuntu18-04-1:~# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.42.5 8268 stable canonical✓ core
docker 18.09.9 423 stable canonical✓ -
google-cloud-sdk 278.0.0 115 stable/… google-cloud-sdk✓ classic
root@ubuntu18-04-1:~# snap refresh
google-cloud-sdk 279.0.0 from Cloud SDK (google-cloud-sdk✓) refreshed
root@ubuntu18-04-1:~#
root@ubuntu18-04-1:~# snap find nextcloud Name Version Publisher Notes Summary nextcloud 16.0.7snap2 nextcloud✓ - Nextcloud Server - A safe home for all your data spreedme 0.29.5snap1 nextcloud✓ - Spreed.ME audio/video calls and conferences feature for the Nextcloud Snap qownnotes 20.2.2 pbek - Plain-text file markdown note taking with Nextcloud / ownCloud integration onlyoffice-desktopeditors 5.4.1 onlyoffice✓ - A comprehensive office suite for editing documents, spreadsheets and presentations nextcloud-port8080 1.01 arcticslyfox - Nextcloud Server nextcloud-snap-abacao 11.0.3snap4 abacao - Nextcloud Server nextcloud-nextant 11.0.0snap3 rmescandon - Nextcloud Server + search support nextcloud-abacao 11.0.3snap4 abacao - Nextcloud Server cashbox-nextcloud 11.0.2snap2 cashbox - Nextcloud Server for www.cashBOX.plus nextcloudsnap 12.0.4snap1 oscarbrolin - Nextcloud Server - A safe home for all your data ghostcloud 0.9.5 beidl - A modern cross-platform client for Nextcloud, ownCloud, WebDav. htxucloud 12.0.3snap7 htxu - Nextcloud Server carnet 0.18.7 alexandre-roux-m - Powerful note taking app with sync, online editor and android app opentodolist 3.18.0 mhoeher - Todo list and note taking application solr 0.1 rmescandon - Starts up solr as forking daemon mdns-hostname 0.0.1 welike - mDNS mini-daemon to published hostname.local nextcloud-stondino 15.0.10snap3+git1.ff25cb9 zmusselman - Nextcloud Server - A safe home for all your data vmcloud-nextcloud 1.0.0 victoriususm - Nextcloud 16.0.3 Optimized-Boosted feedreader 0+git.9ac478f7 ken-vandine - RSS client for various webservices test003-nc 13.0.4.snap1 reinism - Nextcloud Server - A safe home for all your data root@ubuntu18-04-1:~# snap remove hello-world
References