docker on freebsd 11.1 - docker

I am trying to run docker on FreeBSD 11.1, but I am having issues in building my docker images, for example, if I use https://github.com/dockerfile/ubuntu/blob/master/Dockerfile and build it, I get the following error:
khine#dhegdheer  ~/Sandboxes/docker  docker build -t ubuntu-on-freebsd .
Sending build context to Docker daemon 2.56 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04
14.04: Pulling from ubuntu
ee0f4a516087: Pull complete
d9a62ff590c6: Pull complete
3ce5430e3227: Pull complete
1ded2a02619b: Pull complete
2b0bc23c3028: Pull complete
aacde6a2c2eb: Pull complete
Digest: sha256:f30e8ac4eb1048d60012fbf4791a072152950e3a339dadbd43c4ff8c0e198528
Status: Downloaded newer image for ubuntu:14.04
---> aacde6a2c2eb
Step 1 : RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && apt-get update && apt-get -y upgrade && apt-get install -y build-essential && apt-get install -y software-properties-common && apt-get install -y byobu curl git htop man unzip vim wget && rm -rf /var/lib/apt/lists/*
---> Running in 3bc6b0fe4f31
Err http://archive.ubuntu.com trusty InRelease
Err http://security.ubuntu.com trusty-security InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty-backports InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
Could not resolve 'archive.ubuntu.com'
Err http://security.ubuntu.com trusty-security Release.gpg
Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty-backports Release.gpg
Could not resolve 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg Could not resolve 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package build-essential
jail: /bin/sh -c sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && apt-get update && apt-get -y upgrade && apt-get install -y build-essential && apt-get install -y software-properties-common && apt-get install -y byobu curl git htop man unzip vim wget && rm -rf /var/lib/apt/lists/*: failed
The command '/bin/sh -c sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && apt-get update && apt-get -y upgrade && apt-get install -y build-essential && apt-get install -y software-properties-common && apt-get install -y byobu curl git htop man unzip vim wget && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 1
where as, running normal pull, works, as per https://wiki.freebsd.org/Docker:
khine#dhegdheer  ~/Sandboxes/docker  docker run -t -i ubuntu /bin/bash
root#:/# uname -a
Linux 2.6.32 FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
here is the docker version:
khine#dhegdheer  ~/Sandboxes/docker  docker version
Client version: 1.7.0-dev
Client API version: 1.19
Go version (client): go1.9
Git commit (client): 582db78
OS/Arch (client): freebsd/amd64
Server version: 1.7.0-dev
Server API version: 1.19
Go version (server): go1.9
Git commit (server): 582db78
OS/Arch (server): freebsd/amd64
It looks like the docker container is not able to breakout from the jail, as I am able to go into the jail, as per:
root#dhegdheer:/usr/home/khine/Sandboxes/docker # jls
JID IP Address Hostname Path
13 172.17.0.12 /usr/docker/zfs/graph/8099a1566348
root#dhegdheer:/usr/home/khine/Sandboxes/docker # jexec 13 bash
root#:/# uname -a
Linux 2.6.32 FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
root#:/#
What have I missed? Any advice is much appreciated.

Related

How can I install curl inside my container?

I have the following Dockerfile
FROM jupyter/scipy-notebook
#RUN apt-get update && apt-get install -y curl
RUN pip install mlflow
RUN pip install sklearn
RUN apt-get update && apt-get install -y curl
When I do
docker build -t mycontainer .
I get
Step 4/4 : RUN apt-get update && apt-get install -y curl
---> Running in 5defd9816a22
Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y curl' returned a non-zero code: 100
I suspect it is something related with not running as a root?
So how can I install curl in my container from the Dockerfile?
EDIT: I applied the answer that I was given.
Unfortunately it did not work
Step 4/7 : USER root
---> Running in aa6a1b7a023f
Removing intermediate container aa6a1b7a023f
---> 59e87b9598b2
Step 5/7 : RUN apt-get update && apt-get install -y curl
---> Running in 4440ce61ebc6
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package curl
The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y curl' returned a non-zero code: 100
EDIT2: I tried it in a different network setup and it worked.
You're seeing a "permission denied" error when apt attempts to create /var/lib/apt/lists/partial. This is because your process isn't running as root; the jupyter/scipy-notebook image is configured to run as non-root user (it runs as user jovyan).
You can change the user under which commands run in your Dockerfile with the USER directive, like this:
FROM jupyter/scipy-notebook
RUN pip install mlflow
RUN pip install sklearn
USER root
RUN apt-get update && apt-get install -y curl
USER jovyan
Note that I've made sure to reset the user back to jovyan after running the apt-get command.
Try to install it with root as it done in official jupyter/scipy-notebook Dockerfile and set it back to $NB_UID: (see user declaration in official base docker image)
USER root
# Install packages you need:
RUN apt-get update && apt-get install -y curl
# Switch back to jovyan to avoid accidental container runs as root
USER $NB_UID
Here is the hierarchy of base docker images used by jupyter/scipy-notebook:
jupyter/base-notebook -> jupyter/minimal-notebook -> jupyter/scipy-notebook

Unable to install Jenkins on Ubuntu 20.04

I am trying to install Jenkins on my Ubuntu EC2 instance and I performed the following steps to install but couldn't install it.
$sudo apt update
$sudo apt install openjdk-8-jdk
$wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
$sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
$sudo apt update <--------- (Here I am getting below error)
root#ip-172-31-44-187:~# sudo apt update
Ign:1 https://pkg.jenkins.io/debian-stable binary/ InRelease
Err:2 https://pkg.jenkins.io/debian-stable binary/ Release
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in
the certificate verification. [IP: 151.101.154.133 443]
Hit:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:6 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Reading package lists... Done
E: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Instead of upgrading every package with apt-get upgrade, I used:
sudo apt install ca-certificates
And then:
sudo apt-get update worked just fine.
Yeah , I had same problem with this from yesterday , I think this is after yesterday's new update in jenkins 2.303.2 Lts .
Just do ,
apt upgrade ,
apt update,
apt get install jenkins -y .
It worked for me .
I was facing same issue when I tried to install jenkins in AWS ec2 instance (Ubuntu 20.04). Below steps helped me.
Update Ubuntu packages and all installed applications
sudo apt-get update -y
sudo apt-get upgrade -y
Next, Install JDK
sudo apt install openjdk-11-jdk -y
Verify Java version
java -version
Add gpg key for jenkins installation
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
Add the repository address to our /etc/apt/sources.list.d file
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
e> /etc/apt/sources.list.d/jenkins.list'
Update our package list again
sudo apt-get update -y
Install Jenkins
sudo apt-get install jenkins -y
It worked like charm!
I had the same problem with adding Jenkins repository on Ubuntu 18.04
add-apt-repository 'deb https://pkg.jenkins.io/debian-stable binary/'
Ign:5 https://pkg.jenkins.io/debian-stable binary/ InRelease Err:6 https://pkg.jenkins.io/debian-stable binary/ Release Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 199.232.66.133 443] Hit:7 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease Reading package lists... Done E: The repository 'https://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
For fixing this issue you need to install/update ca-certificates
sudo apt install ca-certificates
After that, you can successfully add the Jenkins repository
I would like to correct the first answer provided. You need to run apt install Jenkins -y instead of apt get install jenkins -y. Running the below commands will fix your error. If you are not using root ensure that you add sudo before of all the below commands.
apt upgrade
apt update
apt install jenkins -y
You will find out your jenkins is started using the below command.
service jenkins status
As it might help some, none of the above solutions worked for me, but it was a silly mistake! *Please* read ALL the outputs. In my case, I'd missed an error a few lines above which indicated that I didn't have "curl" installed (!) on my Debian server. And so copy pasting the key installation lines from the Jenkins manual (which uses curl) didn't succeed, so all those unsecure errors in result.
Instead of upgrading every package with the apt-get upgrade, I used: sudo apt install ca-certificates
And then: sudo apt-get update worked just fine
Please Follow these commands
sudo apt-get update
sudo apt install openjdk-8-jdk
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
e> /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins -y

Failing to fetch package from cdn-fastly.deb.debian.org in docker buid

Dockerfile
FROM debian:stretch
RUN apt-get update && apt-get install -yq --no-install-recommends --force-yes --fix-missing\
curl \
git \
openjdk-8-jdk \
maven \
python2.7 python2.7-setuptools \
python3 python3-setuptools \
r-base \
r-base-core && \
rm -rf /var/lib/apt/lists/*
On building this Dokerfile, I got error:
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpsl/libpsl5_0.17.0-3_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/jbigkit/libjbig0_2.1-3.1+b2_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libx/libxmu/libxmuu1_1.1.2-2_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/plexus-cli/libplexus-cli-java_1.2-5_all.deb Connection failed
E: Aborting install.
I used debian mirrors from #atline's answer and it worked for me.
Just want to add an example. For India, I added below step in Dockerfile
RUN echo \
'deb http://mirror.cse.iitk.ac.in/debian/ stretch main\n \
deb http://security.debian.org/debian-security stretch/updates main\n \
deb http://mirror.cse.iitk.ac.in/debian/ stretch-updates main\n' \
> /etc/apt/sources.list
From the source list, I guess this related to different site visit to deb.debian.org:
$ docker run --rm -it debian:stretch cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20190708T033000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main
Move your steps to http://deb.debian.org/, you can see this:
The server deb.debian.org does not have packages itself, but the name has SRV records in DNS that let apt in stretch and later find places.
So I guess, sometimes it will redirect you to one mirror which may not very situable for you because of your local network limit. As a result, I suggest you directly use a suitable sources.list to replace the original one in image, all availables see all the Debian mirrors, you can choose one which in your country.

How to fix 'python: not found' error when using PostCreateCommand in vscode remote docker extension

I'm using the Visual Studio Code Remote - Containers extension with a customized DockerFile. It is based on https://github.com/microsoft/vscode-dev-containers/blob/master/containers/python-3/.devcontainer/Dockerfile but uses a different base image and doesn't try to pip install from requirements.txt.
When I build the container in vscode, with PostCreateCommand set to "python --version", the following errors appears in the dev containers terminal output:
Run: docker exec -w /workspaces/media-classifier dd5e552b4f113ecf74504cc6d3aed3ca1727b4a172645515392c4632b7c45b81 /bin/sh -c python --version
/bin/sh: 1: python: not found
postCreateCommand "python --version" failed.
I've tried using the same setting value for PostCreateCommand (python --version) using both the standard python3 container and the python3 anaconda container and they both successfully output the python version.
I've also tried setting PostCreateCommand to the following values, which all produce the same 'not found' error:
pip --version
conda --version
When the container has started, I'm successfully able to use python, pip and conda so they are definitely installed.
Dockerfile
FROM microsoft/cntk:2.6-cpu-python3.5
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git procps lsb-release \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
devcontainer.json
{
"name": "CNTK Python3.5",
"context": "..",
"dockerFile": "Dockerfile",
// Uncomment the next line if you want to publish any ports.
// "appPort": [],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "python --version",
"extensions": [
"ms-python.python",
"neuron.neuron-ipe"
],
"settings": {
"python.pythonPath": "/opt/conda/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
}
I'm expecting PostCreateCommand to execute successfully and output the python version installed in whichever anaconda environment is active at the time.
you are trying to run python when python3 is installed
try running
python3 --version
Since python3 is not a direct replacement for python v2, Debian based systems have not setup an automatic alias to point python to the python3 binaries. The recommended solution is to point all python v3 commands to python3. The workaround for applications that can't be easily updated is to setup an alias to point python to python3 anyway.
FROM microsoft/cntk:2.6-cpu-python3.5
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install \
git \
lsb-release \
procps \
python-is-python3 \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
For more on this, see https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3
From the comments, here's a similar example with a different base image, also fixed by installing python-is-python3:
$ docker run -it --rm --entrypoint bash mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0
Unable to find image 'mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0' locally
0.202.1-6.0: Pulling from vscode/devcontainers/dotnet
e5ae68f74026: Pull complete
a74667493539: Pull complete
3a0bffe13264: Pull complete
913bac4f4fc9: Pull complete
d2ea5cb43486: Pull complete
1414be57e953: Pull complete
868d7bfddf03: Pull complete
63ab446ca68f: Pull complete
1259b98fc625: Pull complete
802a0f1d31f7: Pull complete
094ecb532868: Pull complete
f643f7ed0620: Pull complete
Digest: sha256:d3bfb3e7c9ecfcb4472b59272e2f8857807667c0bd83fb1da935d28e9087e733
Status: Downloaded newer image for mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0
root ➜ / $ type python
bash: type: python: not found
root ➜ / $ type python3
python3 is /usr/bin/python3
root ➜ / $ apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [102 kB]
Get:6 http://deb.debian.org/debian bullseye/contrib amd64 Packages [50.5 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:8 https://dl.yarnpkg.com/debian stable/main all Packages [10.5 kB]
Get:9 https://dl.yarnpkg.com/debian stable/main amd64 Packages [10.5 kB]
Get:10 http://deb.debian.org/debian bullseye/non-free amd64 Packages [93.8 kB]
Get:11 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8670 kB in 3s (3246 kB/s)
Reading package lists... Done
root ➜ / $ apt-get install -y python-is-python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 2800 B of archives.
After this operation, 13.3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 python-is-python3 all 3.9.2-1 [2800 B]
Fetched 2800 B in 0s (67.0 kB/s)
Selecting previously unselected package python-is-python3.
(Reading database ... 22711 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.9.2-1_all.deb ...
Unpacking python-is-python3 (3.9.2-1) ...
Setting up python-is-python3 (3.9.2-1) ...
Processing triggers for man-db (2.9.4-2) ...
root ➜ / $ type python
python is /usr/bin/python

docker command not found even though installed with apt-get

Adding this for reference for others because it would have saved me 10 minutes if such an answer existed.
I tried installing Docker using ubuntu 14.0LTS virtualbox
sudo apt get install docker
However, when I try running docker it gives me the following error
The program 'docker' is currently not installed. You can install it by typing:
sudo apt-get install docker
Why is ubuntu not seeing docker?
The Ubuntu package docker actually refers to a GUI application, not the beloved DevOps tool we've come out to look for.
The instructions for docker can be followed per instructions on the docker page here: https://docs.docker.com/engine/install/ubuntu/
=== UPDATED (thanks #Scott Stensland) ===
You now run the following install script to get docker:
curl -sSL https://get.docker.com/ | sudo sh
Note: review the script on the website and make sure you have the right link before continuing since you are running this as sudo.
This will run a script that installs docker. Note the last part of the script:
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker stens
Remember that you will have to log out and back in for this to take effect!
To update Docker run:
sudo apt-get update && sudo apt-get upgrade
For more details on what's going on,
See the docker install documentation or #Scott Stensland's answer below
.
=== UPDATE: For those uncomfortable w/ sudo | sh ===
Some in the comments have mentioned that it a risk to run an arbitrary script as sudo. The above option is a convenience script from docker to make the task simple. However, for those that are security-focused but don't want to read the script you can do the following:
Add Dependencies
sudo apt-get update; \
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
Add docker gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
(Security check, verify key fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker#docker.com>
sub rsa4096 2017-02-22 [S]
)
Setup Repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Install Docker
sudo apt-get update; \
sudo apt-get install docker-ce docker-ce-cli containerd.io
If you want to verify that it worked run:
sudo docker run hello-world
The following explains why it is named like this:
Why install docker on ubuntu should be `sudo apt-get install docker.io`?
IMPORTANT - ubuntu package docker is something entirely different ( avoid it ) :
issue following to view what if any packages you have mentioning docker
dpkg -l|grep docker
if only match is following then you do NOT have docker installed below is an unrelated package
docker - System tray for KDE3/GNOME2 docklet applications
if you do see above lets remove it since its the wrong docker
sudo apt-get remove docker # remove the wrong docker
if you see something similar to following then you have docker installed
dpkg -l|grep docker
ii docker-ce 5:19.03.13~3-0~ubuntu-focal amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:19.03.13~3-0~ubuntu-focal amd64 Docker CLI: the open-source application container engine
NOTE - ubuntu package docker.io is not getting updates ( obsolete do NOT use )
Instead do this : install the latest version of docker on linux by executing the following:
sudo apt-get install docker-ce
below is yet another way to issue the install command
sudo curl -sSL https://get.docker.com/ | sh
# sudo curl -sSL https://test.docker.com | sh # get dev pipeline version
here is a typical output ( ubuntu 16.04 )
apparmor is enabled in the kernel and apparmor utils were already installed
+ sudo -E sh -c apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Executing: /tmp/tmp.rAAGu0P85R/gpg.1.sh --keyserver
hkp://ha.pool.sks-keyservers.net:80
--recv-keys
58118E89F3A912897C070ADBF76221572C52609D
gpg: requesting key 2C52609D from hkp server ha.pool.sks-keyservers.net
gpg: key 2C52609D: "Docker Release Tool (releasedocker) <docker#docker.com>" 1 new signature
gpg: Total number processed: 1
gpg: new signatures: 1
+ break
+ sudo -E sh -c apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D >/dev/null
+ sudo -E sh -c mkdir -p /etc/apt/sources.list.d
+ dpkg --print-architecture
+ sudo -E sh -c echo deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c sleep 3; apt-get update; apt-get install -y -q docker-engine
Hit:1 http://repo.steampowered.com/steam precise InRelease
Hit:2 http://download.virtualbox.org/virtualbox/debian xenial InRelease
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:4 http://dl.google.com/linux/chrome/deb stable Release
Hit:5 http://archive.canonical.com/ubuntu xenial InRelease
Hit:6 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial InRelease
Hit:7 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-updates InRelease
Hit:8 http://ppa.launchpad.net/me-davidsansome/clementine/ubuntu xenial InRelease
Ign:9 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 InRelease
Hit:10 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-backports InRelease
Hit:11 http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.2 Release
Hit:12 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial-security InRelease
Hit:14 http://ppa.launchpad.net/numix/ppa/ubuntu xenial InRelease
Ign:15 http://linux.dropbox.com/ubuntu wily InRelease
Ign:16 http://repo.vivaldi.com/stable/deb stable InRelease
Hit:17 http://repo.vivaldi.com/stable/deb stable Release
Get:18 http://linux.dropbox.com/ubuntu wily Release [6,596 B]
Get:19 https://apt.dockerproject.org/repo ubuntu-xenial InRelease [20.6 kB]
Ign:20 http://packages.amplify.nginx.com/ubuntu xenial InRelease
Hit:22 http://packages.amplify.nginx.com/ubuntu xenial Release
Hit:23 https://deb.opera.com/opera-beta stable InRelease
Hit:26 https://deb.opera.com/opera-developer stable InRelease
Get:28 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages [1,719 B]
Hit:29 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Fetched 28.9 kB in 1s (17.2 kB/s)
Reading package lists... Done
W: http://repo.mongodb.org/apt/debian/dists/wheezy/mongodb-org/3.2/Release.gpg: Signature by key 42F3E95A2C4F08279C4960ADD68FA50FEA312927 uses weak digest algorithm (SHA1)
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
aufs-tools cgroupfs-mount
The following NEW packages will be installed:
aufs-tools cgroupfs-mount docker-engine
0 upgraded, 3 newly installed, 0 to remove and 17 not upgraded.
Need to get 14.6 MB of archives.
After this operation, 73.7 MB of additional disk space will be used.
Get:1 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
Get:2 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B]
Get:3 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 docker-engine amd64 1.11.2-0~xenial [14.5 MB]
Fetched 14.6 MB in 7s (2,047 kB/s)
Selecting previously unselected package aufs-tools.
(Reading database ... 427978 files and directories currently installed.)
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package docker-engine.
Preparing to unpack .../docker-engine_1.11.2-0~xenial_amd64.deb ...
Unpacking docker-engine (1.11.2-0~xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu6) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up docker-engine (1.11.2-0~xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
+ sudo -E sh -c docker version
Client:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 22:00:43 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 22:00:43 2016
OS/Arch: linux/amd64
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker stens
Remember that you will have to log out and back in for this to take effect!
Here is the underlying detailed install instructions which as you can see comes bundled into above technique ... Above one liner gives you same as :
https://docs.docker.com/engine/installation/linux/ubuntulinux/
Once installed you can see what docker packages were installed by issuing
dpkg -l|grep docker
ii docker-ce 5:19.03.13~3-0~ubuntu-focal amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:19.03.13~3-0~ubuntu-focal amd64 Docker CLI: the open-source application container engine
now Docker updates will get installed going forward when you issue
sudo apt-get update
sudo apt-get upgrade
take a look at
ls -latr /etc/apt/sources.list.d/*docker*
-rw-r--r-- 1 root root 202 Jun 23 10:01 /etc/apt/sources.list.d/docker.list.save
-rw-r--r-- 1 root root 71 Jul 4 11:32 /etc/apt/sources.list.d/docker.list
cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main
or more generally
cd /etc/apt
grep -r docker *
sources.list.d/docker.list:deb [arch=amd64] https://download.docker.com/linux/ubuntu focal test
sudo apt-get install docker # DO NOT do this
is a different library on ubuntu.
Use sudo apt-get install docker-ce to install the correct docker.
If you want to install docker in an easy way.
Just type:
$sudo apt install docker.io
And, it will start installing.
And, to check whether its working or not type:
$docker
SET UP THE REPOSITORY
For Ubuntu 14.04/16.04/16.10/17.04:
sudo add-apt-repository "deb [arch=amd64] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
For Ubuntu 17.10:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Then install
$ sudo apt-get update && sudo apt-get -y install docker-ce

Resources