How to install Docker in Ubuntu offline - docker

I need to install Docker in an Ubuntu 18 machine which do not have any internet access. There are plethora of instruction material exist on this this subject but all they require Ubuntu machine to be online.
Any help on offline installation of Docker will be highly helpful.
Thanks,

On any machine with internet access, do the following:
Go to https://download.docker.com/linux/ubuntu/dists
Choose your Ubuntu distribution (For 18.0.4 it would be beaver/)
Navigate to pool/stable/<processor architecture>
Download the most recent version of each package
After transferring the .deb files to your offline Ubuntu machine/VM:
In a terminal, navigate to the folder which contains your .deb files
Execute dpkg -i <package1> <package2> <package3> in order to install the downloaded packages
Verify that the service is running by switching to /opt/ and executing systemctl status docker.service
After this you should be able to configure your docker installation and import packages via the docker load command

Run these commands:
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` test"
sudo apt update
sudo apt install docker-ce

Related

Is it possible to nest docker/podman containers

I run Fedora 35, and need to run an app in docker in ubuntu.
I was able to get and run ubuntu via podman
podman pull ubuntu:20.04
and setup do docker there, but can't make it run as I probably didn't enter podman properly probably. I used:
podman run -it ubuntu:20.04
where I ran:
su -
apt update; apt upgrade
apt install inetutils-ping nano sudo npm
apt install apt-transport-https ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" |sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update
apt install docker-ce docker-ce-cli containerd.io
to start docker via systectl is not possible in the container, and dockerd command gives many error, mostly that it can't access overlay, and probably network (iptables)
ERRO[2022-05-07T23:14:18.803335993+02:00] failed to mount overlay: operation not permitted storage-driver=overlay2
ERRO[2022-05-07T23:14:18.803397023+02:00] exec: "fuse-overlayfs": executable file not found in $PATH storage-driver=fuse-overlayfs
ERRO[2022-05-07T23:14:18.803500924+02:00] AUFS wdas not found in /proc/filesystems storage-driver=aufs
ERRO[2022-05-07T23:14:18.803887884+02:00] failed to mount overlay: operation not permitted storage-driver=overlay
Is it possible at all to run and app with service to have open port to outside of docker, and podman as there are 2 layers of nested containers?
It is not possible to use the default storage driver of type overlay inside another container, you need to change the storage to vfs. Maybe https://docs.docker.com/storage/storagedriver/vfs-driver/ helps.
Disclaimer: This works definitely in case of running podman in docker, but the other way around I have not tested.

Installing Docker in Ubuntu on Windows 10 : Failed to Setup IP tables: Unable to enable NAT rule

I am trying to install Docker in Ubuntu on Windows 10 using script below but then I try to run Docker as service service docker start the Docker does not starts and I find an error in docker.log. I was using the same installation instruction on plain Ubuntu machine and had no problem running docker.
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to Setup IP tables: Unable to enable NAT rule: (iptables failed: iptables --wait -t nat -I POSTROUTING -s 172.18.0.0/16 ! -o docker0 -j MASQUERADE: iptables: Invalid argument. Run `dmesg' for more information.
(exit status 1))
Installation script
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Download and add Docker's official public PGP key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify the fingerprint.
sudo apt-key fingerprint 0EBFCD88
# Add the `stable` channel's Docker upstream repository.
#
# If you want to live on the edge, you can change "stable" below to "test" or
# "nightly". I highly recommend sticking with stable!
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update the apt package list (for the new apt repo).
sudo apt-get update -y
# Install the latest version of Docker CE.
sudo apt-get install -y docker-ce
# Allow your user to access the Docker CLI without needing root access.
sudo usermod -aG docker $USER
I encountered the same problem and here is what I found out.
It currently isn't possible to run docker in WSL. The work around is
Update the apt package with:
sudo apt-get update
Install packages to allow apt to use a repository over HTTPS with:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
Add docker's GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Set up a stable repository with:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Update the apt package again:
sudo apt-get update
Install docker DCE:
sudo apt-get install docker-ce
Then add this command which notifies docker of the host to communicate:
echo "export DOCKER_HOST=localhost:2375" >> ~/.bash_profile
Restart your vscode
Install docker desktop and go to your settings and check the "Expose daemon tcp://localhost:2375 without TLS".
With this, I was able to run docker in WSL(ubuntu). Hope it helps.
credit: https://medium.com/#sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4
Running Docker in WSL is not currently possible. You will have to install Docker Desktop in Windows. Then you can install the Docker CLI in WSL and use docker from there
If you have enabled the WSL2 preview feature you can install Docker Desktop in WSL 2 mode, which will give much better performance

Can't connect to docker from WSL

I have checked the option Expose the daemon on tcp... in docker on windows, and am now trying to connect from WSL. I have run all those commands:
# Update the apt package list.
sudo apt-get update -y
# Install Docker's package dependencies.
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
# Download and add Docker's official public PGP key.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify the fingerprint.
sudo apt-key fingerprint 0EBFCD88
# Add the `stable` channel's Docker upstream repository.
#
# If you want to live on the edge, you can change "stable" below to "test" or
# "nightly". I highly recommend sticking with stable!
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Update the apt package list (for the new apt repo).
sudo apt-get update -y
# Install the latest version of Docker CE.
sudo apt-get install -y docker-ce
# Allow your user to access the Docker CLI without needing root access.
sudo usermod -aG docker $USER
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
However, docker info only gives me:
Client:
Debug Mode: false
Server:
ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
errors pretty printing info
What might be wrong? I have been trying this all day. I am running WSL and Ubuntu 18.04, not WSL 2, as the update that brings WSL 2 doesn't seem to be avaible yet without an insider build.
if you run env | sort do you see the DOCKER_HOST=tcp://localhost:2375 variable? if not you may need to run source ~/.bashrc to load the new environment variable into the current console.
Alternatively start a new terminal instance.
Also and this may seem like a daft question but i have to ask, is docker running correctly? from powershell if you run docker info does it return the status of the docker server?

Cannot install docker machine in ubuntu running in virtual box

I am trying to set up whole docker eco system in ubuntu linux running in virtualbox. I succeed in installing docker engine. But I cannot install docker compose and docker machine. Below are the steps I followed to install docker machine.
$ base=https://github.com/docker/machine/releases/download/v0.14.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker- machine &&
sudo install /tmp/docker-machine /usr/local/bin/docker-machine
I am getting below error
/usr/local/bin/docker-machine: line 1: Not: command not found
While running the command docker-machine --version
first uninstall older versions first
sudo apt-get remove docker docker-engine docker.io
Update the apt package index:
$ sudo apt-get update
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
this 4 lines are one single command. copy paste it.
sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <docker#docker.com>
sub 4096R/F273FCD8 2017-02-22
set up the stable repository. You always need the stable repository,
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Update the apt package index one more time.
sudo apt-get update
Install the latest version of Docker CE
sudo apt-get install docker-ce
test if it is installed
docker --version
INSTALL DOCKER COMPOSE
Run this command to download the current stable release of Docker Compose:
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
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
test it
docker-compose --version

Install Docker on Ubuntu 18.04? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I checked the documentation page for Docker on Ubuntu and I don't see 18.04, which was released recently.
https://docs.docker.com/install/linux/docker-ce/ubuntu/
Anyone installed docker on 18.04?
UPDATE: the docker documentation has been updated now and includes 18.04
Following link https://download.docker.com/linux/ubuntu/dists/bionic/pool/,
You can choose stable now.
$ sudo cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
The easiest way to install Docker is via Ubuntu image repository:
sudo apt install docker.io
Restart your computer, then do:
systemctl start docker
systemctl enable docker
https://www.howtoforge.com/tutorial/ubuntu-docker/
You can install docker using one simple command:
curl -fsSL https://get.docker.com | sh
Works not only on ubuntu but on all platforms supported by docker (kinda)
Create an apt source-list file with the following content:
/etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic nightly
Update repositories and install the docker engine:
sudo apt update
sudo apt install docker-ce
You can use stable instead of nightly in the deb declaration of the apt source file as soon as it becomes available.
I followed the installation guide Get Docker CE for Ubuntu
and in step 4 I added the edge repository:
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
edge"
Since, I was not able to install community edition of docker by ading the edge repository (add-apt-repository). Hence, I had to install using the deb files.
In order to install docker community edition on Ubuntu Bionic - I used the following steps.
Step 1: Download the .deb files using the wget utility:
wget -c https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb
wget -c https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce-cli_19.03.1~3-0~ubuntu-bionic_amd64.deb
wget -c https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_19.03.1~3-0~ubuntu-bionic_amd64.deb
Step 2: Now Install the downloaded files using dpkg utility:
sudo dpkg -i containerd.io_1.2.6-3_amd64.deb
sudo dpkg -i docker-ce-cli_19.03.1~3-0~ubuntu-bionic_amd64.deb
sudo dpkg -i docker-ce_19.03.1~3-0~ubuntu-bionic_amd64.deb
References:
https://docs.docker.com/install/linux/docker-ce/ubuntu/
Stable Repositories of Docker for Ubuntu Bionic are available at:
https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/
18.04 was not a stable release but an Edge releases. Switch to the edge channel.
Edit: sorry, you mean Ubuntu 18.04, not Docker 18.04
Maybe this helps: https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver
You now have three clean options:
a standard Ubuntu package: docker.io
a snap package from Docker Inc which has some restrictions on where your Dockerfile is, and is 5 months more out-of-date than the Ubuntu package, but works on more Linux distros
the official docker-ce package from Docker Inc, which requires their private repo and more install steps
For more helpful instructions, details and references, see askubuntu: Docker-CE or docker.io package
Here is how you can install Docker CE on Ubuntu 18.04:
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 bionic test"
sudo apt update sudo apt install docker-ce
Now, check the installed version using this command:
docker -v

Resources