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

Kamal setup fails due to docker login issue #1258

Open
azzenabidi opened this issue Nov 27, 2024 · 7 comments
Open

Kamal setup fails due to docker login issue #1258

azzenabidi opened this issue Nov 27, 2024 · 7 comments

Comments

@azzenabidi
Copy link

Hi, I followed the documentation and tutorial.

Every time I run kamal setup, it starts executing. It installs docker on the remote server then I get this error:
ERROR (SSHKit::Command::Failed): docker exit status: 32000 docker stdout: Nothing written docker stderr: flag needs an argument: 'p' in -p See 'docker login --help'.
I verified that I could access the server with ssh and login to my docker as well.
Any solution?

@sealabcore
Copy link

I am also experiencing a similar issue

 /Users/miketaylor/dev/maple [map-7152]% kamal setup
  INFO [8478fdf0] Running /usr/bin/env mkdir -p .kamal on 54.85.206.39
  INFO [8478fdf0] Finished in 2.576 seconds with exit status 0 (successful).
Acquiring the deploy lock...
Ensure Docker is installed...
  INFO [69bf76ca] Running docker -v on 54.85.206.39
  INFO [69bf76ca] Finished in 0.301 seconds with exit status 127 (failed).
  INFO [abd25424] Running [ "${EUID:-$(id -u)}" -eq 0 ] || command -v sudo >/dev/null || command -v su >/dev/null on 54.85.206.39
  INFO [abd25424] Finished in 0.302 seconds with exit status 0 (successful).
  INFO Missing Docker on 54.85.206.39. Installing…
  INFO [bb109a6f] Running /usr/bin/env sh -c 'curl -fsSL https://get.docker.com || wget -O - https://get.docker.com || echo "exit 1"' | sh on 54.85.206.39
  INFO [bb109a6f] Finished in 64.480 seconds with exit status 0 (successful).
Log into image registry...
  INFO [bb96c61a] Running docker login 292743968775.dkr.ecr.us-east-1.amazonaws.com/maple/api -u [REDACTED] -p [REDACTED] as miketaylor@localhost
  Finished all in 0.0 seconds
Releasing the deploy lock...
  Finished all in 69.1 seconds
  ERROR (SSHKit::Command::Failed): docker exit status: 32512
docker stdout: Nothing written
docker stderr: sh: docker: command not found

@azzenabidi
Copy link
Author

I am also experiencing a similar issue

 /Users/miketaylor/dev/maple [map-7152]% kamal setup
  INFO [8478fdf0] Running /usr/bin/env mkdir -p .kamal on 54.85.206.39
  INFO [8478fdf0] Finished in 2.576 seconds with exit status 0 (successful).
Acquiring the deploy lock...
Ensure Docker is installed...
  INFO [69bf76ca] Running docker -v on 54.85.206.39
  INFO [69bf76ca] Finished in 0.301 seconds with exit status 127 (failed).
  INFO [abd25424] Running [ "${EUID:-$(id -u)}" -eq 0 ] || command -v sudo >/dev/null || command -v su >/dev/null on 54.85.206.39
  INFO [abd25424] Finished in 0.302 seconds with exit status 0 (successful).
  INFO Missing Docker on 54.85.206.39. Installing…
  INFO [bb109a6f] Running /usr/bin/env sh -c 'curl -fsSL https://get.docker.com || wget -O - https://get.docker.com || echo "exit 1"' | sh on 54.85.206.39
  INFO [bb109a6f] Finished in 64.480 seconds with exit status 0 (successful).
Log into image registry...
  INFO [bb96c61a] Running docker login 292743968775.dkr.ecr.us-east-1.amazonaws.com/maple/api -u [REDACTED] -p [REDACTED] as miketaylor@localhost
  Finished all in 0.0 seconds
Releasing the deploy lock...
  Finished all in 69.1 seconds
  ERROR (SSHKit::Command::Failed): docker exit status: 32512
docker stdout: Nothing written
docker stderr: sh: docker: command not found

what worked for me is injecting my dockerhub token in kamal_password in .secrets then I added .secrets to gitignore so that it does not get pushed to the server for security reasons. they say another method is setting up environment variables in bashrc. I still have not tried that tho.

@azzenabidi
Copy link
Author

I fixed my issue by adding env variable to .bashrc file as follows
export KAMAL_REGISTRY_PASSWORD="your dockerhub account token"

then load env variables by executing:

source ~/.bashrc

kamal 2 documentation needs to be updated to account for such details. I will send a PR

@refacrot
Copy link

refacrot commented Dec 7, 2024

Hey everyone!
I faced the same issue and fixed it by changing the alias:

kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -e KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'

so I added

-e KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD

and then just set KAMAL_REGISTRY_PASSWORD=my_token

@acidtib
Copy link
Contributor

acidtib commented Dec 7, 2024

using the gem will fix this issues

@danielfriis
Copy link

I'm using the kamal gem but still getting this issue as well. Kamal doesn't pick up my .env file

@acidtib
Copy link
Contributor

acidtib commented Dec 9, 2024

I'm using the kamal gem but still getting this issue as well. Kamal doesn't pick up my .env file

Kamal works using the secret file https://kamal-deploy.org/docs/configuration/environment-variables/

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

5 participants