You are not logged in.
Hi everyone, I am trying to solve an issue with containers on my personal laptop. I have both Docker and Podman installed. I installed docker via the procedure on its website (no pacman or AUR packages). The problem is that when I launch a container and I bind mount a folder, the user in the container cannot write in the folder, whether the container manager is docker or podman.
For instance, here's a very simple Dockerfile, which does not work (uid is the same as my user in the host):
FROM debian:latest
ARG username=stduser
RUN useradd -u 1000 ${username}
USER ${username}
What I've tried to do:
1. checked that the user ID and the group ID for the container user are the same as the host user
2. tried to add the flag
--security-opt label:disable
3. chown-ed the folder that I try to bind mount with my non-root user
but nothing changed
I really don't know what to do: I had another laptop (at work) with Ubuntu 22.04, and I do not encounter this issue. However, given the procedure I followed on my Arch (really straightforward, I followed the instructions at letter), I am surprised that I was unable to find other users with the same issue as me.
I also tried with the docker package in the AUR, and that produces the same result.
Before concluding the message, I'd like to give you a bit of context on the use case, because I have found a workaround for it, but it's not very optimal. The use case consists of running an image of Debian, defined in a Dockerfile, pulled from the vscode repository for C++ development. In fact, devcontainers are the use case for my setup, but to reproduce the problem, it is sufficient that I run the container via CLI, so it is an issue of docker and podman. The workaround I found is to use distrobox (relying on podman), which somehow manages to deal well with sharing folders; but this means that I have multiple copies of vscode: one for each distro in distrobox, and that the result is not exactly the same as the one I'd have with a devcontainer.
Please, any help will be highly appreciated! I'm struggling with this since 3 months ? and I don't want to dual boot with another distro just to be able to work properly at some point ?
Last edited by Splashy3852 (2024-11-17 21:59:34)
Offline
Upstream devs usually target distros using .deb or rpm and their code often need adjustments to work correctly on archlinux .
Archlinux packages do those things for you, but if you install outside of pacman you are responsible for making those adjustments.
Read https://wiki.archlinux.org/title/Docker#Installation , verify you do have those services running and basic docker functionality works .
The problem is that when I launch a container and I bind mount a folder, the user in the container cannot write in the folder, whether the container manager is docker or podman.
What is the exact command that you use to bind-mount the folder and what does it output on terminal/log-files ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Online
Upstream devs usually target distros using .deb or rpm and their code often need adjustments to work correctly on archlinux .
Archlinux packages do those things for you, but if you install outside of pacman you are responsible for making those adjustments.
Read https://wiki.archlinux.org/title/Docker#Installation , verify you do have those services running and basic docker functionality works .
The problem is that when I launch a container and I bind mount a folder, the user in the container cannot write in the folder, whether the container manager is docker or podman.
What is the exact command that you use to bind-mount the folder and what does it output on terminal/log-files ?
Hi, thanks for the reply. I've been trying to check yesterday about some things you asked, but unfortunately I did not have much time. I will provide a precise answer during the weekend. However, I wanted to point out some things:
1. I've been imprecise while saying that docker has not been installed with pacman. In fact, I tried with both installation method (manual and pacman), and nothing changed. I will do a clean installation this weekend to see what happens.
2. The same issue applies to podman, so for the sake of completeness, I will post the commands that I use also for podman, since its installation has been clean since the beginning (by using pacman), and (most importantly) it does not rely on system services to run, which may be another source of problem.
3. Doing a chmod 777 . -R, or running my IDE as sudo are things that solve the issue, but it's very unsafe to do. We can conclude that the superuser in the container can access and modify the files: the problem must be related to the "normal" user.
So, I will write again soon, and integrate the additional info to the original post, so that it will be easier to read
Offline