Skip to content

Docker faq

ArneWittgen edited this page Apr 21, 2023 · 3 revisions

Docker

First of all, read the Docker text about containers.


Q1: Starting docker in WSL2 gives an error message.

Possible issues:

  1. You may need to do sudo docker - if so, add yourself to the docker group according to the instructions in Q2.
  2. The Docker server is not yet started - look in the system tray to find the Docker icon.

Q2: How do I put myself in the docker group? (and why should I)

Adding your username to the docker group will allow you to run docker commands with your user account instead of as root. This means you won't have to type sudo in front of each docker command you use (and as a result, you don't have to type in your account password for every command). Additionally, it will avoid issues with Spark and Zeppelin web interfaces later.

Add the group if it does not yet exist:

sudo groupadd docker

Add yourself to the group (the -a is important or you may lock yourself out of administration rights):

sudo usermod -aG docker ${USER}
su -s ${USER}

If the su -s fails, just quit your terminal and start another one, and if that still does not help, logout and login again. Now test for success:

docker run hello-world

Q3: I receive the error message connect to host 434c982d9cb4 port 22: Connection refused, what should I do?

Because we use a rather small docker image, the SSH deamon does not restart when restarting the docker. This has to be done manually, which you can do by issuing:

sudo /opt/ssh/sbin/sshd

Q4: How do I put/get files from/to the docker container?

You can exchange files between the host and the container in many different ways:

  1. Use docker cp to copy files between a container and the local filesystem e.g.: docker cp tmp.txt hello-hadoop:tmp.txt which moves the file tmp.txt from your file system into the container. By swapping the parameters, docker cp hello-hadoop:tmp.txt tmp.txt you can move a file from the container to your file system.

  2. Use scp to copy files via lilo (the FNWI LInux LOgin server); your homedir in the terminal room is also mounted through NFS on lilo.

  3. Third option, not possible in the Huygens terminal rooms: Create a directory ${HOME}/bigdata in your homedir that you share with the Docker container using the -v flag to the docker run command.

  4. Use a git repo checked out on host and inside container. Note that the course container does not install git so you'd have to add it.


Q4.5: I'm using WSL2 and can't find my files in Linux!

At the risk of oversimplifying, the files/directories visible in the Linux environment are located in a folder somewhere in your Windows file system (actually, a virtual drive but that's more technical detail than necessary), and Linux can't see anything "outside" of that folder. To find said folder, run explorer.exe . in Linux, which will open an explorer window in the location of your Linux files. for a somewhat longer explanation, click this link. To get files to and from Linux, simply copy them from their source to the Linux location (or vice versa). You can edit files directly in the Linux folder as well.


Q5: Podman instead of Docker

  1. Install podman
  2. In some distributions, add the package podman-docker for convenience - then you do not even have to type podman instead of docker and everything works exactly as in the assignment instructions
  3. You may encounter an error when pulling rubigdata repositories: Error: short-name "rubigdata/<repo>" did not resolve..., to resolve this try prepending the short-name with docker.io, i.e. podman pull docker.io/rubigdata/redbad
  4. Check if you need to do the same (moving containers to another location) as on the Huygens machines, by reading the Huygens FAQ

Please add a Q&A pair when you have seen a question and know the answer!

Clone this wiki locally