Recently, I have been dealing with the deployment of multiple Debian servers which I had to configure in a pretty tailored way and also running Docker was a must. As I was performing the deployments by hand, after a few times finishing the Docker service installation I reached the conclusion that things needed to speed up.
That said, the quickest way that I found to do it was as easy as parsing every command pointed in installation process (which you can check in the official Docker documentation) directly into the machines through a snippet that I posted on Gist to make it available for anyone interested on it.
So yeah, as you can guess this is another one-liner shot focused to save some time. So if you are thinking of installing Docker in a Debian system, just try:
curl -s https://gist.githubusercontent.com/mtnezm/502cdb812caa25a32ddd994f6fbff0df/raw/e7ec8f706fc88623f0fb097b4d9704c4e0b4bd9a/install_docker_debian.bash | sudo bash
Of course, I encourage you to check the content of whatever you run before doing so, for many reasons. In this case, note that by default I am installing the latest available version of docker-ce
and also docker-compose
.
When the installation of Docker finishes, you can check if it is active on your machine by running:
sudo systemctl status docker
After that, you should see something like this:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-06-20 15:42:47 CEST; 33s ago
Docs: https://docs.docker.com
Main PID: 3769 (dockerd)
Tasks: 12
Memory: 47.9M
CGroup: /system.slice/docker.service
└─3769 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Note that there is also an official script from Docker to provide an automated installation located at this GitHub repository, so you just can follow any method you prefer, but keep in mind that, as the Docker team points, this method is only recommended in TESTING AND DEVELOPMENT ENVIRONMENTS.
And that’s all, now you can start containerizing whatever you want! I hope you find this as useful as I have. As always, any feedback is welcome.
Cheers!
curl -fsSL get.docker.com | sh
Un saludo
Hello and thank you for your comment!
Unfortunately, the command you provided returns an error code when running it, even on a fresh Debian installation. This is the reason why I didn’t even mention it on my article. As you can see, this is the output:
root@server:~# curl -fsSL get.docker.com | sh
# Executing docker install script, commit: 26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl gnupg >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/debian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ [ -n ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
E: Sub-process /usr/bin/dpkg returned an error code (2)
Although the workaround for fixing this error message seems to be pretty easy, the main goal of our blog’s content is to provide reliable, trustworthy solutions.
Best regards.
Hello! I just wanted to ask if you ever have any problems with hackers?
My last blog (wordpress) was hacked and I ended up losing many months of hard work due
to no data backup. Do you have any solutions to prevent
hackers?