question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker-compose builds as root

See original GitHub issue

First, thank you very much for this wonderful node-boilerplate, It really does cover a long tech stack which I am trying to complete bit by bit.

Problem which I encountered when I tried to run this as described, simply did: cd nodejs-api-starter docker-compose up

And I get this error: api_1 | EACCES: permission denied, mkdir 'build/emails' api_1 | EACCES: permission denied, mkdir 'build/emails' … and so on.

The problem here is that the build directory created by running build.js through docker-compose is root protected and doesn’t allow any further changes, so the build process fails and finally the ./build/server.js is unavailable. I can manually create a build directory that is not root protected and repeat the process then it works. Probably something to do with docker’s functioning and my lack of experience in working with it. Can you help me figure out a work around?

screenshot: http://i.imgur.com/ckiomWY.png

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
smishr4commented, Feb 9, 2018

I think probably something to do the way docker creates the directory on linux machine. https://github.com/docker/compose/issues/2781#issuecomment-176791391

https://stackoverflow.com/questions/33509752/docker-compose-creates-file-owned-by-root

Anyways instead of doing mkdir build the neater solution would be to just give the permission using chown

Doing this works too:

sudo chown -R $USER:$USER . docker-compose up

Thanks Since this is problem with the way docker is working on ubuntu, you can close this issue and create a reference. Again its a great project and I am kinda struggling with graphql-relay as I have only learned graphql just recently using express-graphql with graphiql interface to write queries, if you can suggest me a good place to start from, that would be a good help.

0reactions
ghostcommented, Feb 9, 2018

@smishr4 On our side, other than running an initial mkdir build as the account running docker-compose up. I don’t know another way around it. The interesting thing is that this only happens for me on my ubuntu server, not on my local macOS. would be curious as to why that initial folder creation is run under root context.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure docker-compose.yml to up a container as root
With this, the connection of the containers works. Exists a method to configure my docker-compose.yml to connect my containers like root without ...
Read more >
Compose file build reference - Docker Documentation
The Compose Build specification allows to define the build process within a Compose ... a docker build, looking for a canonical Dockerfile at...
Read more >
"docker-compose up" as root user or non-root user?
The Docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user...
Read more >
Setting the volume as a root user in Docker-Compose ... - GitHub
docker -compose.yml: version: '3.7' services: bentoml: build: /home/ali/bentoml/repository/MLServices/1.0.2 volumes: - ./config.ini:/home/bentoml/config.ini ...
Read more >
How to set user and group in Docker Compose - g-dem's blog
When I create a file using Docker (or, in my case, Docker Compose, the logic is the same in general), the file is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found