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

docker-compose.yml issues on Linux #783

Closed
mdrovdahl opened this issue Jul 12, 2018 · 4 comments
Closed

docker-compose.yml issues on Linux #783

mdrovdahl opened this issue Jul 12, 2018 · 4 comments

Comments

@mdrovdahl
Copy link
Contributor

Steps to reproduce

  1. Follow "Running" steps in README.md
  2. On step 2, use sudo docker up install, see below for why sudo...
  3. Install fails b/c of path issues- WARNING: The PWD variable is not set. Defaulting to a blank string. and then ERROR: for simplenoteelectron_install_1 Cannot create container for service install: create .: volume name is too short, names should be at least two alphanumeric characters

What I expected

sudo docker-compose up install and sudo docker-compose up dev to work.

What happened instead

On Linux, it's not uncommon for docker to be setup such that docker commands require sudo. However, the $PWD in the volumes: sections of the docker-compose.yml don't get set properly with sudo.

markd@xps:~/dev/simplenote-electron$ docker-compose up install
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
markd@xps:~/dev/simplenote-electron$ sudo docker-compose up install
WARNING: The PWD variable is not set. Defaulting to a blank string.
Creating simplenoteelectron_install_1 ... error

ERROR: for simplenoteelectron_install_1 Cannot create container for service install: create .: volume name is too short, names should be at least two alphanumeric characters

ERROR: for install Cannot create container for service install: create .: volume name is too short, names should be at least two alphanumeric characters
ERROR: Encountered errors while bringing up the project.
markd@xps:~/dev/simplenote-electron$ env | grep PWD
PWD=/home/markd/dev/simplenote-electron
OLDPWD=/home/markd/dev
markd@xps:~/dev/simplenote-electron$ sudo env | grep PWD
markd@xps:~/dev/simplenote-electron$

One workaround is to not run docker commands with sudo, ref: https://docs.docker.com/install/linux/linux-postinstall/ BUT it would be ideal if the docker-compose.yml worked with the sudo.

OS version

markd@xps:~/dev/simplenote-electron$ cat /proc/version
Linux version 4.9.0-6-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07)

Screenshot / Video

@mdrovdahl
Copy link
Contributor Author

Related info here: docker/compose#5003

@mdrovdahl
Copy link
Contributor Author

Another workaround is to set the $PWD variable to the absolute path of your "simplenote-electron" directory with on the command line...eg:

sudo PWD="/home/markd/dev/simplenote-electron" docker-compose up install

@mdrovdahl
Copy link
Contributor Author

Closing as this issue doesn't necessarily need action, more an FYI for others.

@mhadam
Copy link

mhadam commented Jun 9, 2022

Since you left this off as an FYI, hopefully this helps too cause I came across this thread after running into something similar (completely unrelated to this project).

sudo has an -E flag that passes the environment (current user for most people probably) to the shell created by sudo.

So instead of sudo PWD="/home/markd/dev/simplenote-electron" docker-compose up install, you could do:

sudo -E docker-compose up install

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