I started a new class and I am new in using Linux. I use debian and I follow to teacher guide to install git and docker. I entered all the commands in the terminal until I had some error.
-
sudo apt install git
worked
git config --global user.name "Ion Popescu"
git config --global user.email "[email protected]"
git config --global core.editor vim
git config --global core.pager more
git config --global help.autocorrect true
all worked
-
sudo apt-get -y remove docker docker-engine docker.io
worked
sudo apt update
sudo apt install -y apt-transport-https ca-certificates wget
sudo apt install -y software-properties-common ssh
worked all of them
5.
wget https://download.docker.com/linux/debian/gpg
sudo apt-key add gpg
worked
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list.d/docker.list
worked
Now I have to enter these lines but I get an error after the first one
7.
sudo apt update
sudo apt-cache policy docker-ce
sudo apt -y install docker-ce
E: Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list (Component)
E: The list of sources could not be read.
How to solve this?
2
Answers
To make sure that
/etc/apt/sources.list.d/docker.list
is formatted correctly use the following command (tee
without-a
to override the source):On debian Buster:
On debian Stretch:
(You can use
$(lsb_release -cs)
instead of debian codename which requirelsb-release
package to be installed.)An alternative way to add
docker-ce
repository: You have already installedsoftware-properties-common
, you can useadd-apt-repository
to add the repository:Docker-ce docs
Try this, it worked for me :
The problem is with the variable
$(lsb_release -cs)
, in linux it returns something likeuna
(at least on Mint 20.3). I don’t think there is a special repository for mint so you must hard code it. I was following the official doc, but also read this forum where it was mentioned that you also need to delete the current docker list available in/etc/apt/sources.listd/docker.list
.