unexpected argument '-c' found

100 views Asked by At

I'm using this docker image. I assume this is the official one.

Following the basic instructions from that page I have an instance with either of the two example commands docker run --rm --pull always --name surrealdb -p 8000:8000 surrealdb/surrealdb:latest start

or

docker run --rm --pull always --name surrealdb -p 8000:8000 surrealdb/surrealdb:latest start --log trace --user root --pass root memory

However, when I attempt to use the example command to access the CLI

docker exec -it <COPIED_FROM_DOCKER> /surreal sql -c http://localhost:8000 -u root -p root --ns test --db test --pretty

I get the above error unexpected argument '-c' found

I have looked at the official documentation but I see no example of trying to use the docker exec command.

Is the documentation in docker hub incorrect? I'm on macOS Sonoma 14.2.

1

There are 1 answers

1
soyapencil On

I would suggest first using docker exec -it <container_name> sh or similar, then try running /surreal sql .... This will help you to see if there is a problem with your docker exec invocation, or with the command.

My gut instinct is that the command is the problem, and that you should be using

docker exec -it <COPIED_FROM_DOCKER> surreal sql --endpoint http://localhost:8000 -u root -p root --ns test --db test --pretty

per the documentation here: https://docs.surrealdb.com/docs/cli/sql#example-usage

The differences there are:

  • use surreal, not /surreal
  • use --endpoint, not -c.

(I think that the documentation in Docker hub has a typo, and should have -e, not -c -- the two look quite similar at a glance.)