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

Config path of docker container can't be mapped #2196

Closed
Disane87 opened this issue Apr 24, 2021 · 35 comments
Closed

Config path of docker container can't be mapped #2196

Disane87 opened this issue Apr 24, 2021 · 35 comments

Comments

@Disane87
Copy link

Disane87 commented Apr 24, 2021

If I want to run verdaccio on my unraid server, I can't map the folders /config/ to a host folder. If I want to map them, the container won't start. There are no logs.

The same occurs when I want to start the start the container on my Windows 10 system with WSL2 by following command:

docker run -it --rm --name verdaccio -p 4873:4873 -v C:\temp\verdaccio\conf:/verdaccio/conf -v C:\temp\verdaccio\storage:/verdaccio/storage -v C:\temp\verdaccio\plugins:/verdaccio/plugins  verdaccio/verdaccio

If I run the container without the port mapping, it starts flawlessly by this command:

docker run -it --rm --name verdaccio -p 4873:4873  verdaccio/verdaccio

The container should start with mapped /config/ folder.
Unfortunatly there is currently nothing more I could share with you.

I guess there is something strange with the permissions itself. IMHO there are missing permission mappings for the /config at this line:

RUN adduser -u $VERDACCIO_USER_UID -S -D -h $VERDACCIO_APPDIR -g "$VERDACCIO_USER_NAME user" -s /sbin/nologin $VERDACCIO_USER_NAME && \

Unfortunatly I'm not that docker expert to debug this.

@juanpicado
Copy link
Member

@Disane87
Copy link
Author

Could you reproduce it with the mentioned commands locally at your machine? Or is this only a problem at my machine?

@juanpicado
Copy link
Member

@Disane87 I'll give it a try on windows and ubuntu. I'll post here my results when I'm done.

@Disane87
Copy link
Author

@Disane87 I'll give it a try on windows and ubuntu. I'll post here my results when I'm done.

ok great, thank you in advance! :)

@Disane87
Copy link
Author

Disane87 commented May 9, 2021

Any updates on this? If not, how can I assist you to get a solution?

@Disane87
Copy link
Author

Disane87 commented May 11, 2021

Actually I tried to set the permissions manually like stated in the docs

Note: Verdaccio runs as a non-root user (uid=10001) inside the container, if you use bind mount to override default, you need to make sure the mount directory is assigned to the right user. In above example, you need to run sudo chown -R 10001:65533 /path/for/verdaccio otherwise you will get permission errors at runtime. Use docker volume is recommended over using bind mount.

The permissions seems to be fine imho on my unraid server:
image

But the container won't start anyways. Only If I ditch the bind mapping of the config folder the container is starting.

the unraid is starting the container with this command:

docker run -d --name='verdaccio' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -p '4873:4873/tcp' -v '/mnt/user/appdata/verdaccio/storage/':'/verdaccio/storage':'rw' -v '/mnt/user/appdata/verdaccio/plugins/':'/verdaccio/plugins':'rw' -v '/mnt/user/appdata/verdaccio/conf/':'/verdaccio/conf':'rw' -it 'verdaccio/verdaccio'
f4bd058bdf6182e154f7f7c0a68831d9a27dfbe80c316520e8655d5d947ff880

@juanpicado
Copy link
Member

juanpicado commented May 13, 2021

Please try with verdaccio/verdaccio:fix-docker-ps

 docker run -it --rm --name verdaccio -p 4873:4873 -v 'C:\Users\xxx\projects\docker-example\:/verdaccio/conf/' -e DEBUG=* verdaccio/verdaccio:fix-docker-ps

;-) I had to install windows

@juanpicado
Copy link
Member

If you add -e DEBUG=verdaccio* you will be able to see interesting debug code in the terminal

@Disane87
Copy link
Author

If you add -e DEBUG=verdaccio* you will be able to see interesting debug code in the terminal

Oh totally forgot it, shame on me. Will try it later :) enjoy Father's Day!

@Disane87
Copy link
Author

Disane87 commented May 13, 2021

Unfortunately it's not working, neither on my windows nor on my unraid server. I tried it with your mentioned command:

Please try with verdaccio/verdaccio:fix-docker-ps

 docker run -it --rm --name verdaccio -p 4873:4873 -v 'C:\Users\xxx\projects\docker-example\:/verdaccio/conf/' -e DEBUG=* verdaccio/verdaccio:fix-docker-ps

;-) I had to install windows

Only a bit changed to use C:\temp\verdaccio-docker

On my unraid server isn't working too:
image

Used command (internally by unraid):

docker run -d --name='verdaccio' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e 'DEBUG'='verdaccio*' -p '4873:4873/tcp' -v '/mnt/user/appdata/verdaccio/storage/':'/verdaccio/storage/':'rw' -v '/mnt/user/appdata/verdaccio/plugins/':'/verdaccio/plugins/':'rw' -v '/mnt/user/appdata/verdaccio/conf/':'/verdaccio/conf/':'rw' -it 'verdaccio/verdaccio:fix-docker-ps'
2b1b148ace2a9b891ce8fd884b9fd1efe2a760adc07692ebd8f87600f98a19e3

Log on window says:

verdaccio:logger setup logger +0ms
verdaccio:logger logging stdout enabled +1ms
verdaccio:logger has prettifier? true +1ms
verdaccio yaml parse failed +0ms

My C:\temp\verdaccio-docker\ is empty too:
image

@juanpicado
Copy link
Member

verdaccio yaml parse failed +0ms

This means the config file was not found. I did manage to map the config on Windows 10 and works fine using the same script to shared (file within config file must be named config.yaml. Unfortunately I don't have RAID (I not even know what it is) so I cannot help there.

@Disane87
Copy link
Author

Disane87 commented May 13, 2021

Unraid is a server software for creating NAS/Server systems. It's a cheap hypervisor for homelabs. This is where all my dev dockers are running.

But what I don't understand is why this image is running on your windows and not on mine? I use the same command to start the container

@Disane87
Copy link
Author

Just tested it again with your command on windows. It's not working when I want to map the conf folder. All other folders are ok.

@juanpicado
Copy link
Member

All other folders are ok.

🤔 https://github.com/verdaccio/verdaccio/pull/2249/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R50

It's listed there, I wonder why does not work for you. Maybe someone else with Windows can give it a try @verdaccio/kubernetes @verdaccio/collaborators

@Disane87
Copy link
Author

I guess this is a general issue since this even occurs on my unraid (linux machine) too. But this is totally against your observation that this fix is working on your windows machine. This is pretty strange.

@gihanrangana
Copy link

same issue for me also

@juanpicado
Copy link
Member

same issue for me also

Please try the custom tag image I posted above (possible fix)

@gihanrangana
Copy link

same issue for me also

Please try the custom tag image I posted above (possible fix)

you mean this?
verdaccio/verdaccio:fix-docker-ps

@Disane87
Copy link
Author

same issue for me also

Please try the custom tag image I posted above (possible fix)

you mean this?
verdaccio/verdaccio:fix-docker-ps

yes

@gihanrangana
Copy link

already tried it.but didn't work

@Disane87
Copy link
Author

@juanpicado which version of docker are you using?

Docker version 20.10.5, build 55c4c88

This is my version. Maybe an version issue?

BTW: My windows system was only a system to check if the problem is reproducable on other systems. The main system where it should run is a linux one.

@juanpicado
Copy link
Member

already tried it.but didn't work

share context please what command are you running and exact output, versions etc.

@juanpicado
Copy link
Member

juanpicado commented May 15, 2021

@juanpicado which version of docker are you using?

Docker version 20.10.5, build 55c4c88

This is my version. Maybe an version issue?

BTW: My windows system was only a system to check if the problem is reproducable on other systems. The main system where it should run is a linux one.

Docker version 20.10.6, build 370c289 (Windows 10)

@Disane87
Copy link
Author

Wow, this is really pretty weird.

@juanpicado
Copy link
Member

I just tried on a clean ubuntu installation, works for me using verdaccio/verdaccio:latest. I'll double check in Windows 10.

Screenshot 2021-05-15 231515

storage: /verdaccio/storage/data
plugins: /verdaccio/plugins
web:
  title: Verdaccio Docker
  primary_color: #444444
  darkMode: true
auth:
  htpasswd:
    file: /verdaccio/storage/htpasswd
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
packages:
  '@*/*':
    access: $all
    publish: $authenticated
    unpublish: $authenticated
    proxy: npmjs
  '**':
    access: $all
    publish: $authenticated
    unpublish: $authenticated
    proxy: npmjs
server:
  keepAliveTimeout: 60
middlewares:
  audit:
    enabled: false
logs: { type: stdout, format: pretty, level: http }

@juanpicado
Copy link
Member

juanpicado commented May 15, 2021

Same in Windows with almost the same conf above (only config file)

Screenshot 2021-05-15 232752

ok, that's my 0.5 cents, I'd suggest you check more in your side what's the problem.

@Disane87
Copy link
Author

Thank you! Do you have the created config.yaml accessible under the given mapped folder?
Did you created the config file manually before you started the container or does this automagically happen?

I updated docker to the latest version on my windows only for reference) and the following command, it's one by one identical with yours (only the username is changed) is not working:

docker run -it --rm --name verdaccio -p 4873:4873 -v 'C:\Users[username]\projects\verdaccio-docker:/verdaccio/conf' -e DEBUG=verdaccio* verdaccio/verdaccio
verdaccio:logger setup logger +0ms
verdaccio:logger logging stdout enabled +0ms
verdaccio:logger has prettifier? true +1ms
verdaccio yaml parse failed +0ms

image

@juanpicado
Copy link
Member

juanpicado commented May 15, 2021

Thank you! Do you have the created config.yaml accessible under the given mapped folder?

Did you created the config file manually before you started the container or does this automagically happen?

I updated docker to the latest version on my windows only for reference) and the following command, it's one by one identical with yours (only the username is changed) is not working:

docker run -it --rm --name verdaccio -p 4873:4873 -v 'C:\Users[username]\projects\verdaccio-docker:/verdaccio/conf' -e DEBUG=verdaccio* verdaccio/verdaccio

verdaccio:logger setup logger +0ms

verdaccio:logger logging stdout enabled +0ms

verdaccio:logger has prettifier? true +1ms

verdaccio yaml parse failed +0ms

image

The file must be there. (It is not created automatically)

@Disane87
Copy link
Author

Aaaaah. I guess this is the issue. I actually anticipated this file would be created automatically. LIke the default config when you start it via npm.

And now it's working...

Would this be a good shot for the docker docs? I've read this section very carefully but I couldn't find a hint for this.

@juanpicado
Copy link
Member

Aaaaah. I guess this is the issue. I actually anticipated this file would be created automatically. LIke the default config when you start it via npm.

And now it's working...

Would this be a good shot for the docker docs? I've read this section very carefully but I couldn't find a hint for this.

:) be my guest repo 'verdaccio/website' hint: read contributions guideline.

@Disane87
Copy link
Author

Disane87 commented May 15, 2021

Just created a PR. It's my first contribution ever, so don't be so hard with me.

@Disane87
Copy link
Author

Disane87 commented May 15, 2021

@juanpicado You can consider this a closed. Thank you for your patience and assistance :)

@gihanrangana
Copy link

i have got it fixed after i added the config.yaml to my mapped folder, now i can't push the packages its' getting errors like that

on server

 info --- auth/allow_action: access granted to: undefined
 info --- gihan is allowed publish for @sky/purets
 info --- auth/allow_action: access granted to: undefined
 info --- gihan allowed unpublish for @sky/purets
 http --- 404, user: gihan(182.172.22.49), req: 'PUT /@sky%2fpurets', error: no such package available

on Local

npm ERR! code E404
npm ERR! 404 Not Found - PUT http://skysoftlk.com:4873/@sky%2fpurets - no such package available
npm ERR! 404
npm ERR! 404  '@sky/purets@1.0.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gihan\AppData\Roaming\npm-cache\_logs\2021-05-16T07_37_24_457Z-debug.log

@gihanrangana
Copy link

gihanrangana commented May 16, 2021

command i ran
docker run -it --name verdaccio -p 4873:4873 -v /home/gihan/verdaccio/conf/:/verdaccio/conf -v /home/gihan/verdaccio/storage/:/verdaccio/storage verdaccio/verdaccio

@Disane87
Copy link
Author

You should open a separate issue for your publish problem, since there is no connection between the startup problem and you current issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants