basecamp/kamal

Kamal setup fails due to docker login issue

Opened this issue · 7 comments

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?

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

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.

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

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

using the gem will fix this issues

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

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/