Установка Docker в Linux
В данной статье пойдет речь о установке Docker CE — Community Edition, бесплатной версии продукта. Его установка максимально проста, и не потребует больших усилий или знаний в семействе операционных систем Linux.
CentOS, Fedora, RedHat
Удаление старых версий
Первым делом нужно убедиться, что не установлено никаких старых версий. Убедиться в этом, и если что удалить их, можно следующими командами:
Добавление репозитория
Установим все пакеты приложений, которые понадобятся нам в дальнейшем:
И добавим репозиторий:
Установка Docker
Вся установка Docker заключается в команде ниже.
По её завершению службу Docker следует включить вручную:
Проверка работы
Для проверки работы Docker можно запустить специально предназначенный для этого контейнер, который называется «Hello world».
Debian, Mint, Ubuntu
Удаление старых версий
Удаляем любые существующие старые версии:
Добавление репозитория
Сперва следует обновить список пакетов и установить необходимое для дальнейших процедур программное обеспечение:
И затем скачиваем и добавляем ключ официального репозитория Docker:
Для верности, можно проверить полученный ключ выполнив команду проверки его отпечатка.
Результат выполнения команды можно увидеть ниже, сравнивать нужно строчку Key fingerprint:
Теперь добавляем сам репозиторий:
Установка Docker
Обновим список пакетов, на этот раз с новым репозиторием:
Запустим установку Docker:
После чего стоит долждаться её завершения.
Проверка работы
Чтобы проверить работу свеже установленного Docker’a, достаточно лишь выполнить простую команду, которая запустит специальный контейнер «Hello world»:
Simplesmente / install-docker-mint.sh
sudo apt-get update |
sudo apt-get install apt-transport-https ca-certificates -y |
sudo apt-key adv —keyserver hkp://p80.pool.sks-keyservers.net:80 —recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list |
sudo apt-get update |
sudo apt-get purge lxc-docker |
sudo apt-get install linux-image-extra- $( uname -r ) -y |
sudo apt-get install docker-engine cgroup-lite apparmor -y |
sudo usermod -a -G docker $USER |
sudo service docker start |
This comment has been minimized.
Copy link Quote reply
ScottWelker commented Nov 3, 2017
. always leave ’em wanting more eh?
Just poking fun. I suspect you’ve done some good work here. I may return to study it. Thanks for sharing.
This comment has been minimized.
Copy link Quote reply
JREAM commented Nov 22, 2017
This comment has been minimized.
Copy link Quote reply
lfreire80 commented Dec 4, 2017
This comment has been minimized.
Copy link Quote reply
Betanin commented Jan 25, 2018
This comment has been minimized.
Copy link Quote reply
BolkunetsAlexandr commented Jan 30, 2018
This comment has been minimized.
Copy link Quote reply
watchdogR commented Mar 1, 2018
sudo echo deb https://apt.dockerproject.org/repo ubuntu-xenial main >> /etc/apt/sources.list.d/docker.list
bash: /etc/apt/sources.list.d/docker.list: Permission denied
Resolution: cozy/cozy-docs#146
This comment has been minimized.
Copy link Quote reply
alexfraundorf-com commented Mar 23, 2018
This worked perfectly using the fix (sudo su) recommended by watchdogR.
Thank you very much for sharing this!
This comment has been minimized.
Copy link Quote reply
username-is-already-taken2 commented Apr 1, 2018
Thank you very much @Simplesmente
With regards to the error trying to sudo echo, if it helps another fellow noob you can manage those repos within the software sources app.
remember to press the update cache button, this will cover off
dweldon / install-docker.sh
#! /usr/bin/env bash |
# https://docs.docker.com/install/linux/docker-ce/ubuntu/ |
sudo apt-get 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 xenial stable « |
sudo apt-get update |
sudo apt-get install docker-ce |
# https://docs.docker.com/compose/install/ |
sudo curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose- ` uname -s ` — ` uname -m ` -o /usr/local/bin/docker-compose |
sudo chmod +x /usr/local/bin/docker-compose |
# https://docs.docker.com/install/linux/linux-postinstall/ |
sudo groupadd docker |
sudo usermod -aG docker $USER |
This comment has been minimized.
Copy link Quote reply
IAMtheIAM commented May 4, 2018
Thank you. I spent 25 minutes with other commands and none worked except this one.
This comment has been minimized.
Copy link Quote reply
gabbosam commented May 8, 2018
This comment has been minimized.
Copy link Quote reply
ilius commented May 17, 2018
This comment has been minimized.
Copy link Quote reply
ghost commented May 19, 2018
This comment has been minimized.
Copy link Quote reply
lolmaus commented May 28, 2018
Looks like original Docker guide tries to install a Mint-specific Docker version which does not exist. This guide install Ubuntu version.
This comment has been minimized.
Copy link Quote reply
Artem-Panasenko commented May 29, 2018
This comment has been minimized.
Copy link Quote reply
qzmarco commented May 30, 2018
This comment has been minimized.
Copy link Quote reply
nao360 commented Jun 1, 2018
Kudos and thank you, this was nice and easy ✨
This comment has been minimized.
Copy link Quote reply
austincunningham commented Jun 8, 2018
This comment has been minimized.
Copy link Quote reply
tompabes commented Jun 9, 2018
Worked like a charm, thanks!
This comment has been minimized.
Copy link Quote reply
s0kil commented Jun 13, 2018
This comment has been minimized.
Copy link Quote reply
momenso commented Jun 16, 2018
I just missed newgrp docker so it works immediately without requiring sudo.
This comment has been minimized.
Copy link Quote reply
jvzanatta commented Jun 21, 2018
Great script, thanks a lot 🙂
This comment has been minimized.
Copy link Quote reply
rvrichards commented Jun 22, 2018
Excellent, worked for me on Mint 18 Sarah.
This comment has been minimized.
Copy link Quote reply
toaspzoo commented Jun 26, 2018
This comment has been minimized.
Copy link Quote reply
bergpb commented Jun 27, 2018
This comment has been minimized.
Copy link Quote reply
ale10257 commented Jun 30, 2018
This comment has been minimized.
Copy link Quote reply
chmr123 commented Jul 1, 2018
This comment has been minimized.
Copy link Quote reply
windgaucho commented Jul 5, 2018
This comment has been minimized.
Copy link Quote reply
twh270 commented Jul 8, 2018
Thanks, worked perfectly. Remember to log out and log back in before running docker commands, the usermod change doesn’t take effect immediately.
This comment has been minimized.
Copy link Quote reply
hejunchen commented Jul 19, 2018
Great script, thanks. I have been looking for one like this.
This comment has been minimized.
Copy link Quote reply
pilgrim2go commented Jul 24, 2018
This comment has been minimized.
Copy link Quote reply
fmandres92 commented Aug 14, 2018
Thanks a lot, Your code is working
This comment has been minimized.
Copy link Quote reply
artze commented Aug 17, 2018
Verified to be working! Thanks!!
This comment has been minimized.
Copy link Quote reply
Mduduzi commented Aug 24, 2018
This comment has been minimized.
Copy link Quote reply
Howard-HS commented Aug 25, 2018
verified to be working, thanks a lot!
This comment has been minimized.
Copy link Quote reply
psolarski commented Aug 29, 2018
This comment has been minimized.
Copy link Quote reply
SteveBidenko commented Sep 1, 2018
This comment has been minimized.
Copy link Quote reply
petar-stoyanov7 commented Sep 12, 2018
Thank you, good sir!
This comment has been minimized.
Copy link Quote reply
jnfrati commented Sep 12, 2018
Beffore any apt-get install you should make an apt-get update! Greetings and thank you for the guide
This comment has been minimized.
Copy link Quote reply
pdynarowski commented Sep 14, 2018
This comment has been minimized.
Copy link Quote reply
sergiofilhowz commented Sep 16, 2018
This comment has been minimized.
Copy link Quote reply
LDiga commented Sep 17, 2018
Отдуши!! 2 дня мучался!
This comment has been minimized.
Copy link Quote reply
0pentek commented Sep 18, 2018
This comment has been minimized.
Copy link Quote reply
dwityaPrawira commented Sep 22, 2018
This comment has been minimized.
Copy link Quote reply
diegorondao commented Oct 2, 2018
This comment has been minimized.
Copy link Quote reply
abdel-GitHub commented Oct 15, 2018
This comment has been minimized.
Copy link Quote reply
aurelienlair commented Oct 18, 2018
This comment has been minimized.
Copy link Quote reply
sjpatrick commented Nov 2, 2018
Worked perfectly. Thanks. You rock.
This comment has been minimized.
Copy link Quote reply
sjpatrick commented Nov 2, 2018
PS, that was for mint19.
This comment has been minimized.
Copy link Quote reply
EvilPuppet commented Nov 3, 2018
Thanks dude this works for me, i’m using mint 19
This comment has been minimized.
Copy link Quote reply
johnt1000 commented Nov 7, 2018
This comment has been minimized.
Copy link Quote reply
laissonsilveira commented Nov 8, 2018
This comment has been minimized.
Copy link Quote reply
Tea-pot commented Nov 9, 2018
This comment has been minimized.
Copy link Quote reply
orehush commented Nov 15, 2018
This comment has been minimized.
Copy link Quote reply
fernandobrscunha commented Nov 29, 2018
This comment has been minimized.
Copy link Quote reply
Wahba91 commented Dec 6, 2018
This comment has been minimized.
Copy link Quote reply
famachot commented Dec 6, 2018
This comment has been minimized.
Copy link Quote reply
ronalddimas13 commented Dec 8, 2018
Worked perfectly
Thank you
This comment has been minimized.
Copy link Quote reply
lcloss commented Dec 31, 2018
Awesome! Worked perfectly on Ubuntu 18.04.
Thank you so much.
This comment has been minimized.
Copy link Quote reply
DenSul commented Jan 21, 2019
This comment has been minimized.
Copy link Quote reply
antimoroma commented Jan 22, 2019
This comment has been minimized.
Copy link Quote reply
iteremasov commented Feb 1, 2019
This comment has been minimized.
Copy link Quote reply
caravan4eg commented Feb 13, 2019
This comment has been minimized.
Copy link Quote reply
RicardoGeek commented Feb 21, 2019
at last.
The trick is to have the correct repo added 👍
Thanks for the help!
This comment has been minimized.
Copy link Quote reply
gillallifam commented Mar 18, 2020
2019 still working!
This comment has been minimized.
Copy link Quote reply
john-light commented Mar 29, 2020
hey @dweldon thanks for publishing this! I ran into some errors on the sudo apt install docker-ce step. Any idea what might be going wrong here? https://gist.github.com/john-light/0fde66e399417efaad8bf560ba687eeb
if you do take a look, we can move to the comments on my gist so we don’t clutter up your comment section here with my issues 🙂
This comment has been minimized.
Copy link Quote reply
dweldon commented Mar 29, 2020
@john-light I’ll admit I haven’t used this gist in a couple of years, so I’m not sure just by looking at the error log. I’d try experimenting with different deb versions depending on your OS (e.g. you may be using a more recent version of ubuntu). According to this, there’s also eoan and bionic available. You could try uninstalling and using one of those in the sudo add-apt-repository step.
This comment has been minimized.
Copy link Quote reply
john-light commented Mar 29, 2020
@dweldon thanks again! I am using Mint 18.3 (based on xenial) which is how I found this gist. I think I found some clues about the problem, seems to be a networking error. I will continue investigating.