Skip to content

Instantly share code, notes, and snippets.

@nuga99
Last active April 17, 2024 09:15
Show Gist options
  • Star 80 You must be signed in to star a gist
  • Fork 36 You must be signed in to fork a gist
  • Save nuga99/dd5ac250b4c98154b5065d8affec7b49 to your computer and use it in GitHub Desktop.
Save nuga99/dd5ac250b4c98154b5065d8affec7b49 to your computer and use it in GitHub Desktop.
Install Docker Engine on Parrot OS (2023)
#!/bin/sh
# From https://www.hiroom2.com/2017/09/24/parrotsec-3-8-docker-engine-en/
# Changelog:
# @DavoedM: Apr 3, 2020
# @C922A10971734: Jan 19, 2023
set -e
# Install dependencies.
sudo apt install -y curl apt-transport-https \
software-properties-common ca-certificates
# Grab OS Codename
CODENAME=$(lsb_release --codename | cut -f2)
# Install docker.
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/debian $CODENAME stable" | \
sudo tee /etc/apt/sources.list.d/docker-engine.list
sudo apt-get update -y
sudo apt-get install -y docker-ce
# Run docker.
sudo systemctl start docker
sudo systemctl enable docker
# Add user to docker group for using docker without sudo command.
sudo gpasswd -a "${USER}" docker
# Reboot
sudo reboot
@phantom2jz
Copy link

ty man <3

@PHTremor
Copy link

Thanks for this.

@DevKelvin21
Copy link

thanks man

@ghostprotocol99
Copy link

thanks man

@nichmorgan
Copy link

thanks!!!!!

@Rayzen-dev
Copy link

Rayzen-dev commented Jul 5, 2022

docker-ce : Depend: docker-ce-cli but will not be installed
             Depend: containerd.io (>= 1.2.2-3) but will not be installed
             Recommand: aufs-tools but it is not installable
             Recommand: cgroupfs-mount but will not be installed or
                         cgroup-lite but it is not installable
 docker-desktop : Dépend: qemu-system-x86 (>= 5.2.0) but will not be installed
                  Dépend: docker-ce-cli but will not be installed
                  Dépend: pass but will not be installed
                  Dépend: uidmap but will not be installed

@xb4dc0d3
Copy link

xb4dc0d3 commented Jul 10, 2022

@Rayzen-dev let me check if there's an update. If you have already solved the issue, glad to hear your solution 😄

@umairabbasDev
Copy link

thank you

@J7a4s0m5ine
Copy link

Anyone facing any issues?

docker: Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown.

docker: 19.03.15

temp fix

sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd

having the same issue in Jan 2023 with Docker version 19.03.15, build 99e3ed8919 that was installed using this script

@J7a4s0m5ine
Copy link

Partly my mistake, I didn't realize how old this script was. Updating a few lines will bring it into 2023.

For example using the apt pack of "stretch" won't allow you access to the latest version of docker for obvious reasons. Better to use "bullseye."

image

@nuga99
Copy link
Author

nuga99 commented Jan 18, 2023

@C922A10971734 could you please create the revision? Thank you.

@J7a4s0m5ine
Copy link

J7a4s0m5ine commented Jan 18, 2023

https://gist.github.com/J7a4s0m5ine/6e50c9b3e699f64ecd9bc0647f67a15a

@nuga99 I'm not sure how to do a pull request on gists or contribute to this gist but I added my changes here on my fork. Just added a one-liner and variable to grab the codename and dynamically use that to input the deb repo.

This should future-proof that aspect given parrotOS and docker debian releases align.

@J7a4s0m5ine
Copy link

@nuga99 I didn't realize gists were just git repos with minimal web gui functionality, who knew. See my fork for the changes.

@nuga99
Copy link
Author

nuga99 commented Feb 22, 2023

@C922A10971734 Thank you for your contribution. I have added your account to the changelog as a contributor.

@rizkytegar
Copy link

rizkytegar commented Mar 24, 2023

I came across this error, does anyone know how to solve it?

Err:9 https://download.docker.com/linux/debian ara Release
  404  Not Found [IP: 108.138.141.89 443]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/debian ara 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.
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1

@nuga99
Copy link
Author

nuga99 commented Mar 24, 2023

@rizkytegar What is debian ara release? You need to check the distribution first
https://download.docker.com/linux/debian

@rizkytegar
Copy link

@nuga99

'ara Release' is the default of Parrot Security OS

@nuga99
Copy link
Author

nuga99 commented Mar 27, 2023

because there's no official release from Parrot OS (cmiiw), you need to install based on debian. You can change the $CODENAME variable to buster for example. @rizkytegar

@J7a4s0m5ine
Copy link

J7a4s0m5ine commented Mar 28, 2023

@nuga99

Ugh, yeah I half-arsed that contribution. No error handling around the code name and deb command, plus if no valid release is found it should default to something

On another note, every version I've tried does give a valid debian code name. I'd be interested to hear about the setup @rizkytegar is using

@nuga99
Copy link
Author

nuga99 commented Apr 3, 2023

@C922A10971734 will soon change the bash script to default if not found

@J7a4s0m5ine
Copy link

@nuga99 This might require keeping a list of valid releases that are available at https://download.docker.com/linux/debian, or doing a preliminary check to see if it is available.

Based on what @rizkytegar said, theirs was returning ara Release as the codename, which means the command is returning properly but not with a debian release but a parrot specific release name

Further thinking....my changes to help automate part of the process might in turn complicate things. Might be easier for the user to just determine the release version on their own and fill in CODENAME=

@rahmadsandy
Copy link

E: The repository 'https://download.docker.com/linux/debian n/a Release' does not have a Release file.

n/a means there is not spesific release for Parrot, so you need to add debain spesific like "stretch" for example

work with

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg


echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

@coHipa
Copy link

coHipa commented Jul 21, 2023

work with

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg


echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1 W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1 W: Target Translations (stable/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1 W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/docker-engine.list:1 and /etc/apt/sources.list.d/docker.list:1

This didn't help me

@nuga99
Copy link
Author

nuga99 commented Jul 24, 2023

@coHipa seems you need to change the CODENAME part

@J7a4s0m5ine
Copy link

@coHipa

You likely have two entries in your /etc/apt/sources.list.d/docker-engine.list file (see image below). The other possibility is that you have an entry in that file, and also have a similar competing entry in another file.

In short, you have two deb entries somewhere in your source lists. Run the following command to search through your sources to find where you have entries

sudo grep -Ri 'https://download.docker.com/linux/' '/etc/apt/sources.list.d/'

The output for me shows the two entires I added to file for this example:

/etc/apt/sources.list.d/docker-engine.list:deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable
/etc/apt/sources.list.d/docker-engine.list:deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable

image


@nuga99

@C922A10971734 will soon change the bash script to default if not found

I have a massive update coming that will remedy the issues everyone's having, except for the one I explain above because it's not related. The main issue here is that ParrotOS started using their own distro and build names. These names, such as Ara will never match a corresponding debian name.

image

@J7a4s0m5ine
Copy link

J7a4s0m5ine commented Jul 26, 2023

EDIT:

Everything I talk about below has been moved to an official repo to track issues/contributions.

https://github.com/J7a4s0m5ine/docker-debian-installer


@nuga99 and others:

Here's my latest attempt at this problem. Definitely not my proudest work, I'm very rusty in bash apparently. It now provides an interactive install experience that guides the user through choosing distribution, build, and architecture. So it should cover everyone's cases of being able to install easily. Unfortunately like I mentioned before, build names between ParrotOS and Debian will no longer match. So it will require some intuition or research on the user's side. Albeit, this stops any crazy erroneous possibilities with finding a release name and the like during script runtime.

Everything is data-dynamic, all choices are pulled directly from docker's directory browser, so any future choices available will automatically populate in the menu choices. Nothing is hardcoded except for window size, errors, and contributions. There are checks and faults for unsupported distros as well as platforms that don't provide debs/source and only have static assets.

I've automated the testing to this across every version of ParrotOS and every other Debian based OS. There are ways this script can screw up an install. For example using Parrot v5.3 and choosing Debian Bookworm stable amd64 will put you in a situation where containerd and other dependencies cannot be installed because the subsequent dependencies for those requirements are incompatible. Someday down the line I'll provide checks/fixes for this but its outside the purview of what I want to accomplish for now; I have a ton of other projects to be working on.

From space with 💕,
C9

USAGE

Simply run the command to download and run with bash:

wget -O - https://raw.githubusercontent.com/J7a4s0m5ine/docker-debian-installer/main/docker-debian-interactive-install.sh | bash

Things to fix and or provide as new features:

  • Check if docker is installed/Allow for uninstall or changes
  • Check if previous entry in sources.lists exists
    • Delete all entries in sources.lists
  • Change window size to be dynamic
  • Provide functions for non-debian systems
  • Generalize the entire approach to be able to provide an apt HTTP URL and install anything!!

Screenshots

Distro Selection

image

Build Selection

image

Arch Selection

image

Installation Confirmation

image

Reboot Confirmation

image

@J7a4s0m5ine
Copy link

J7a4s0m5ine commented Jul 29, 2023

@nuga99

To fix the above original script (the one in this gist), I have formalized a simpler solution than my new project above with the interactive installer.

Realistically we can just keep key/value pairs in a bash associative array that relate Parrot Codenames to Debian Codenames. My above solution will eventually be brought into a different direction which will include much more than docker.

Basically

distribution_mappings=( ["ara"]="bullseye" ["ara2"]="bookworm") and so on 

This will have to be manually updated overtime, but seems like the simplest approach.

@Subhodip1307
Copy link

getting this error please some one help me "
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20210119).
curl is already the newest version (7.88.1-10+deb12u3~bpo11+1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
software-properties-common : Depends: python3-software-properties (= 0.96.20.2-2.1) but it is not installable
Recommends: packagekit but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
"

@tchoumi313
Copy link

E: The repository 'https://download.docker.com/linux/debian n/a Release' does not have a Release file.

n/a means there is not spesific release for Parrot, so you need to add debain spesific like "stretch" for example

work with

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg


echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Thanks man, this works perfectly

@User-DK
Copy link

User-DK commented Apr 17, 2024

@J7a4s0m5ine thanks your script works smoothly

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