Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create /tmp/cache with write permissions #55

Closed
t3easy opened this issue Jul 13, 2018 · 1 comment
Closed

Create /tmp/cache with write permissions #55

t3easy opened this issue Jul 13, 2018 · 1 comment

Comments

@t3easy
Copy link
Contributor

t3easy commented Jul 13, 2018

To share composer cache between multiple runs I use your example with an additional volume for the cache:

composer () {
    tty=
    tty -s && tty=--tty
    docker run \
        $tty \
        --interactive \
        --rm \
        --user $(id -u):$(id -g) \
        --volume /private/etc/passwd:/etc/passwd:ro \
        --volume /private/etc/group:/etc/group:ro \
        --volume $(pwd):/app \
        --volume cache:/tmp/cache \
        composer composer "$@"
} 

As the folder /tmp/cache doesn't exists, docker creates it with drwxr-xr-x so it's not writable by the user running the composer command.

To avoid this, I create an empty /tmp/cache folder

RUN mkdir -p -m 777 /tmp/cache
@alcohol
Copy link
Member

alcohol commented Nov 19, 2018

That is because volumes created at runtime by docker-compose (only if they do not exist yet) are created by root, and not as the user that will end up running the process in the container.

@alcohol alcohol closed this as completed Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants