Permission denied when running docker-compose run api yarn
psyanite opened this issue · 10 comments
This is a possibly a Windows 10 bug and sorry because my understanding of Docker is not too well.
When I run docker-compose run --rm --no-deps api yarn
in CMD it gives the following output:
yarn install v1.1.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4]
Linking dependencies...
error Could not write file "/usr/src/app/yarn-error.log": "EACCES: permission denied, open '/usr/src/app/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/src/app/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
So I'm guessing this command runs yarn inside the docker container to download all the node_modules into the container, tries to do some logging because it does not have permission to make the node_modules directory. I haven't figured out how it knows to do all that because when I comment out both Dockerfiles the same thing happens and there's no sign of yarn under api in the docker-compose.yml file.
Any help will be greatly appreciated 😭 😭 😭
If I add read_only: true
to docker-compose.yml/services/api
it would produce this error.
Can you try adding this flag but setting it to false
? Or, if it doesn't solve the issue you can try adding privileged: true
, assuming that it will only be used during development.
Hi, thanks for getting back to me so quickly, I tried adding both of those flags and now the error has changed.
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose\cli\main.py", line 68, in main
File "compose\cli\main.py", line 121, in perform_command
File "compose\cli\main.py", line 762, in run
File "compose\cli\main.py", line 1151, in run_one_off_container
File "compose\project.py", line 468, in initialize
File "compose\network.py", line 257, in initialize
File "compose\network.py", line 61, in ensure
File "compose\network.py", line 93, in inspect
File "site-packages\docker\utils\decorators.py", line 34, in wrapper
File "site-packages\docker\utils\decorators.py", line 19, in wrapped
File "site-packages\docker\api\network.py", line 200, in inspect_network
File "site-packages\docker\utils\decorators.py", line 46, in inner
File "site-packages\docker\api\client.py", line 189, in _get
File "site-packages\requests\sessions.py", line 488, in get
File "site-packages\requests\sessions.py", line 475, in request
File "site-packages\requests\sessions.py", line 596, in send
File "site-packages\requests\adapters.py", line 423, in send
File "site-packages\requests\packages\urllib3\connectionpool.py", line 595, in urlopen
File "site-packages\requests\packages\urllib3\connectionpool.py", line 363, in _make_request
File "httplib.py", line 1042, in request
File "httplib.py", line 1082, in _send_request
File "httplib.py", line 1038, in endheaders
File "httplib.py", line 882, in _send_output
File "httplib.py", line 844, in send
File "site-packages\docker\transport\npipeconn.py", line 31, in connect
File "site-packages\docker\transport\npipesocket.py", line 22, in wrapped
File "site-packages\docker\transport\npipesocket.py", line 50, in connect
pywintypes.error: (2, 'WaitNamedPipe', 'The system cannot find the file specified.')
Failed to execute script docker-compose
Due to my basic understanding of Docker, I could potentially run a Unix VM but perhaps it's best if I tried for something different.
Do you have the latest versions of Docker and Docker Compose installed?
$ docker --version
Docker version 17.09.0-ce, build afdb6d4
$ docker-compose --version
docker-compose version 1.16.1, build 6d1ac21
Sorry for the late response, yes :(
> docker --version
Docker version 17.09.0-ce, build afdb6d4
> docker-compose --version
docker-compose version 1.16.1, build 6d1ac219
@psyanite what kernel version is your Docker using? You can find it by running docker info
Wow thanks for the quick response
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: J3ZC:6R7C:OAIY:THPQ:DWCE:O5ZC:AKES:7GCQ:IYSF:I522:2V65:JLZQ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 26
System Time: 2017-10-21T08:40:28.2003076Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
The Kernel version is indeed the latest...
Nonetheless, I know this is all amazing even though I have trouble starting it.
You've been so helpful thank you so so much 👍
Hey!
Sorry to comment on a closed issue, but I have the same problem. Did anyone solved it ? I followed the getting started.
EDIT: Replacing in docker-compose services/api/volumes: -yarn:/home/node/.cache/yarn with services/api/volumes:- ~/.cache/yarn:/home/node/.cache/yarn removed the problem but I am not sure I am supposed to do that...
Did you try to run docker yarn as root ? like this "docker-compose run -u root [targets] yarn