Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
taglia5716yWe run docker on our machines (mac os), but we never faced this kind of problem :/
I'll follow the topic to see how to solve it, in case I will find myself in the same situation. -
Wack63116y@CoffeeNcode I guess you're refering to this section: "Manage Docker as a non-root user", right? I did that but the issue still is, that when I enter the bash in the container, I'm logged in there as root, which inturn causes files generated by the container and synced to the host by the volume to be owned by root.
-
@Wack you want to specify which user runs in the container. Do that in the docker-composer.yml file like this:
version: '3.3'
services:
rspec:
image: my-docker/my-build-environment:latest
environment:
- RAILS_ENV=test
command: ["make", "assets"]
# LIKE THIS:
user: ${CURRENT_UID}
volumes:
- .:/app -
@Wack you'll need to do that for every service you have described in the .yml, that is, every one you don't want to run as root. But once you do that you can just "docker-compose up" it from then on.
Edit: In your case just the services that write the files you're having permission issues should solve it.
Related Rants
-
gururaju53*Now that's what I call a Hacker* MOTHER OF ALL AUTOMATIONS This seems a long post. but you will definitely ...
-
linuxxx65This guy at my last internship. A windows fanboy to the fucking max! He was saying how he'd never use anythi...
-
creedasaurus60Another dev on my team just got a new machine. Before he came in today I made two separate USB installers and ...
Question about permission in `docker-compose`
So far, I've usually used vagrant for local dev. It was nice, as I was able to specify `wack:wack` as owner of all files. However with docker compose, if I connect with exec and use `/bin/bash` I'm logged in as `root`. When I then run composer, it kind of fucks with the file permissions, as after it all new files are owned by root and thus can't be edited with an ide on the "host" system.
One hack that I found suggested creating an user and a group with same uid as on the host and use that instead of root. This just doesn't sound right to me. Any advice on how to handle this situation?
question
symfony
linux
permission
docker-compose
composer
docker