the-teacher / rails7-startkit

Launch Rails with 1 shell command!

Home Page:https://github.com/the-teacher/rails7-startkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bin/setup issue

gkeepa opened this issue · comments

commented

hi, i tried to follow the steps to setup the env, but bin/setup kept giving out this error:

ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]

Docker version 20.10.12, build 20.10.12-0ubuntu4

error:
/rails7-startkit$ bin/setup
Docker version 20.10.12, build 20.10.12-0ubuntu4

  1. Launching PgSQL container
    unknown shorthand flag: 'f' in -f
    See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/home/cmb/.docker")
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/home/cmb/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/home/cmb/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/home/cmb/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Hey @gkeepa ! Thank you for your report!

There must be executed docker compose command, not docker

Launching PgSQL container
unknown shorthand flag: 'f' in -f
See 'docker --help'.

Can you please check what the following commands give you.

$ docker --help
$ docker compose --help

On my laptop I have the following:

$ docker --version
Docker version 20.10.21
$ docker --help

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/Users/the-teacher/.docker")
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/Users/the-teacher/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/Users/the-teacher/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/Users/the-teacher/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit
$ docker compose --help

Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
    --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
    --compatibility              Run compose in backward compatibility mode
    --env-file string            Specify an alternate environment file.
-f, --file stringArray           Compose configuration files
    --profile stringArray        Specify a profile to enable
    --project-directory string   Specify an alternate working directory
                                 (default: the path of the, first specified, Compose file)
-p, --project-name string        Project name
commented

thanks. what's your docker compose version, mine doesnt have the -f, -d option, my docker version is 20.10.12:

$ docker compose -help
unknown shorthand flag: 'e' in -elp
See 'docker --help'.

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/home/cmb/.docker")
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/home/cmb/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/home/cmb/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/home/cmb/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

@gkeepa hello again!

$ docker compose -help
unknown shorthand flag: 'e' in -elp

unknown shorthand flag: 'e' in -elp

Looks like you mistyped the command and got help information for docker not for docker compose

Can you please try one more time and let me know about your results.

docker compose --help

Thank you!

On my side

$ docker-compose --version
Docker Compose version v2.13.0

and

$ docker compose

Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the, first specified, Compose file)
  -p, --project-name string        Project name
commented

hi, i typed 'docker compose --help', it still showing the same help:

$ docker compose --help

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/home/cmb/.docker")
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/home/cmb/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/home/cmb/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/home/cmb/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

however, i tried to use 'docker-compose --help' i can see the '-f' option, but still no '-d' option:

$ docker-compose --version
docker-compose version 1.29.2, build unknown

$ docker-compose --help
Define and run multi-container applications with Docker.

Usage:
docker-compose [-f ...] [--profile ...] [options] [--] [COMMAND] [ARGS...]
docker-compose -h|--help

Options:
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name
(default: directory name)
--profile NAME Specify a profile to enable
-c, --context NAME Specify a context name
--verbose Show more output
--log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
--ansi (never|always|auto) Control when to print ANSI control characters
--no-ansi Do not print ANSI control characters (DEPRECATED)
-v, --version Print version and exit
-H, --host HOST Daemon socket to connect to

--tls Use TLS; implied by --tlsverify
--tlscacert CA_PATH Trust certs signed only by this CA
--tlscert CLIENT_CERT_PATH Path to TLS certificate file
--tlskey TLS_KEY_PATH Path to TLS key file
--tlsverify Use TLS and verify the remote
--skip-hostname-check Don't check the daemon's hostname against the
name specified in the client certificate
--project-directory PATH Specify an alternate working directory
(default: the path of the Compose file)
--compatibility If set, Compose will attempt to convert keys
in v3 files to their non-Swarm equivalent (DEPRECATED)
--env-file PATH Specify an alternate environment file

@gkeepa thank you a lot!
The case is clear!

On linux we have only docker-compose (with minus in between), on MacOS there is stand alone command docker compose.

Ok. I need to think what to do.

Great investigation and help. Thank you for your efforts!

@gkeepa
Looks like on Linux you use an old version of Docker compose.
For sure it is possible to use even it. But maybe you can try to follow steps from this article to install Docker Compose v2?

https://www.rockyourcode.com/how-to-install-docker-compose-v2-on-linux-2021/

This is the reason of the issue.

$ docker-compose --version
docker-compose version 1.29.2, build unknown

My project is using command docker compose (without hyphen). It is 2nd version.

On Mac I have

$ docker compose version
Docker Compose version v2.13.0

Btw, on my Debian server it also shows 2nd version

# docker compose version
Docker Compose version v2.12.2

On mac I can run docker-compose and docker compose
On Debian server I have only docker compose

commented

thanks. i just installed docker-compose v2.15.1, but still getting the same issue:
$docker-compose --version
Docker Compose version v2.15.1

i think the prob is that linux is treating docker and docker-compose as 2 separate components:
i dont know much about docker and docker compose(want to learn through this project), according to the help text, docker supports '-d' and docker-compose supports '-f', so the command below in the setup script will keep giving me problems, unless it can be translated into linux command:

step_info "Launching PgSQL container"
system('docker compose -f docker/docker-compose.yml up psql -d')

based on your feedback I will try to make a workaround. Thank you a lot for your help and feedback!
I will let you know about any results ASAP.

commented

i think i found a solution: my current docker was installed by sudo apt-get install docker, i uninstalled it and followed the following steps and was able to run the script now.

https://docs.docker.com/desktop/install/ubuntu/