Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Debian - install docker in Debian Jessie
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-cache policy docker-engine
sudo apt-get install docker-engine -y
sudo service docker start
sudo docker run hello-world
sudo group add docker
sudo groupadd docker
sudo gpasswd -a $USER docker
sudo service docker restart
@rkevinburton
Copy link

rkevinburton commented Aug 18, 2017

I get to here and the installation fails. The error messages are Greek to me. Any ideas?

sudo group add docker
sudo: group: command not found

@slgoldberg
Copy link

slgoldberg commented Sep 29, 2017

Thanks for making this, but unfortunately after I successfully add the source and key successfully, on the latest jessie version, no errors in your script at all -- until the one below, I wonder if something changed or if my environment is somehow not supported (see below).

The failure is that "apt-get install docker-engine" fails with:

E: Unable to locate package docker-engine

and then of course the rest of the script fails as a result as well.

I have tried three different ways to install Docker on my jessie machine (in fact, on three different machines, all set up slightly differently on different hardware/virtualization platforms, etc.) -- but something common for my installations is breaking this every time. (Whether I do it by hand, or use your script, I still get "not found" on docker-engine.

Is it possible it has something to do with apt getting in a weird state and I need to somehow clear it out? I haven't done anything weird, but since I added this repository using the sources.list.d/ method, using your script, and previously I added the lines directly to my main sources.list (but since commented them out!) .. it never once found "docker-engine", and so I can't imagine what it has cached that might be messing things up.

Anyway, the one question I am unsure of is about the architecture .. I'm running this script on a virtualized server that reports its architecture as "xenU.i386". Could that be the problem? I.e., will it only work on specific architectures? But that doesn't really make sense since it is not even finding the package... I am just unclear on how the third-party package libraries work exactly.

My sources.list is:

deb http://ftp.us.debian.org/debian jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian jessie-backports main

My sources.list.d/docker.list is:

deb https://apt.dockerproject.org/repo debian-jessie main

The key installed fine, and the subsequent apt-get update worked fine and did load tons of stuff from the added apt.dockerproject.org source, e.g.:

Get:8 https://apt.dockerproject.org debian-jessie/main Translation-en_US [454 B]
Get:9 https://deb.nodesource.com jessie/main Translation-en [162 B]
Get:10 https://apt.dockerproject.org debian-jessie/main Translation-en [454 B]
Hit https://packages.gitlab.com jessie/main Sources           
Get:11 https://apt.dockerproject.org debian-jessie/main Translation-en_US [454 B]
... snip ...
Get:14 https://apt.dockerproject.org debian-jessie/main Translation-en [454 B]
... snip ...
Get:16 https://apt.dockerproject.org debian-jessie/main Translation-en_US [454 B]
... snip ...
Get:28 https://apt.dockerproject.org debian-jessie/main Translation-en_US [454 B]
Ign https://apt.dockerproject.org debian-jessie/main Translation-en_US
... more output here ...

Though I do wonder what that last line ("Ign ... ") means exactly... pretty telling, actually, isn't it? I just noticed it as I was pasting. It doesn't have any error thought accompanying it.. The reason for the skipped lines above is that many of them are other sources I have (such as nodeproject.org, etc.).

Any help would be greatly appreciated. I'm only asking it (and reporting it) here in case something changed in the package name and you need to update this (?). But I doubt it. It's worth a shot, anyway. So frustrated at this point trying to get it installed. :-(

Thanks again.

@ousamabenyounes
Copy link

ousamabenyounes commented Dec 19, 2017

Thank you...
Nice script worked for me.
I got some trouble installing docker on my old private server.
using this script everything was working :)

@hpanago
Copy link

hpanago commented Jan 7, 2018

Why dist-upgrade someone's system just to install docker?

@lagaree
Copy link

lagaree commented Mar 15, 2018

hi , my english is not very good . I try for code and i have this error ' no candidate for docker-engine'. i m using debian jessie. help me to fix it please

@Martlark
Copy link

Martlark commented Mar 21, 2018

Thanks!

@cetver
Copy link

cetver commented Mar 31, 2020

FROM ***CHANGE-ME***

USER root

RUN rm /etc/apt/sources.list.d/jessie-backports.list

RUN apt-get update

RUN apt-get install -y sudo curl

RUN curl -fsSL https://get.docker.com -o get-docker.sh

RUN sh get-docker.sh

RUN apt-get clean

RUN rm -rf /var/lib/apt/lists/* 

RUN rm -rf /tmp/* 

RUN rm -rf /var/tmp/* 

RUN rm -rf /usr/share/doc/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment