docker-compose and linux newbie here.
I set up my first docker-compose container and get some errors in my docker logs, which I would like to fix:
failed to setup application, mkdir /mnt/vg1/myapp/: permission denied can't make directory /mnt/vg1/myapp
so I double-checked the directory permissions, which look fine to me:
drwxrwx--- 2 myuser docker 4096 Jan 22 20:54 myapp/
(I also tried chmod 777, which didn't solve the errors)
Then I checked, how to specify a user for running docker-compose up
. I added the user:
-line to my docker-compose.yml
:
version: '2'
services:
myapp:
build: .
image: myuser/myapp:latest
container_name: "myapp"
hostname: "myapp"
user: "myuser"
restart: always
...
Now things got worse: I cannot recreate my docker container.
myuser@myhost:/opt/mydocker$ docker-compose up -d
Removing myapp
Recreating 55419e7048cc_myapp ... error
ERROR: for 55419e7048cc_myapp Cannot start service myapp: unable to find user myuser: no matching entries in passwd file
ERROR: for myapp Cannot start service myapp: unable to find user myuser: no matching entries in passwd file
ERROR: Encountered errors while bringing up the project.
So I checked /etc/passwd
:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
...
myuser:x:1001:1001:My Admin User,,,:/home/myuser:/bin/bash
Seems fine for me. So I'm running out of ideas, how to fix this error. :/
Any ideas, what I might be missing?
Many thanks in advance!
question from:
https://stackoverflow.com/questions/65854051/docker-compose-permission-denied-no-matching-entries-in-passwd-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…