ory / hydra

The most scalable and customizable OpenID Certified™ OpenID Connect and OAuth Provider on the market. Become an OpenID Connect and OAuth2 Provider over night. Broad support for related RFCs. Written in Go, cloud native, headless, API-first. Available as a service on Ory Network and for self-hosters.
https://www.ory.sh/?utm_source=github&utm_medium=banner&utm_campaign=hydra
Apache License 2.0
15.63k stars 1.5k forks source link

Container is not Running #474

Closed milenkozahovic closed 7 years ago

milenkozahovic commented 7 years ago

I try to run a hydra container by using this command

docker run -d --name my-hydra -p 4444:4444 oryd/hydra

then try to exec shell from the container:

docker exec -i -t <container-id> /bin/bash

then i got following error:

Error response from daemon: Container 7e44b5470586470dc2284623c3bd2f466386136524486210d6495cff7ada1964 is not running

aeneasr commented 7 years ago

Check the logs of the docker container, you probably didn't set DATABASE_URL

milenkozahovic commented 7 years ago

Looks like the container is not executed in background after it run.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7e44b5470586 oryd/hydra "/bin/sh -c '/go/b..." 7 minutes ago Exited (1) 7 minutes ago my-hydra

aeneasr commented 7 years ago

It is, just check the logs, it will show you why it didn't start. The container is working fine in prod here ;)

aeneasr commented 7 years ago

If you point me to the section that showed this command, I'll update it accordingly so the container is able to boot properly. 99% missing database url

milenkozahovic commented 7 years ago

I just setup the DATABASE_URL to memory and run the container, and got error message that indicate DATABASE_URL was not set.

time="2017-05-30T09:09:53Z" level=fatal msg="DATABASE_URL is not set, use "export DATABASE_URL=memory" for an in memory storage or the documented database adapters."

weird

aeneasr commented 7 years ago

You need to set -e, see: https://docs.docker.com/engine/reference/commandline/run/

milenkozahovic commented 7 years ago

I run this command and the container still not running:

docker run -d --name my-hydra -p 4444:4444 oryd/hydra -e "DATABASE_URL=memory"

Also the log message is the same with previous one.

aeneasr commented 7 years ago

you can't pass flags after arguments in almost all CLIs, the right order is: docker run -d --name my-hydra -p 4444:4444 -e "DATABASE_URL=memory" oryd/hydra

milenkozahovic commented 7 years ago

thanks a lot. my bad :) :+1:

aeneasr commented 7 years ago

glad you got it working! would you mind updating the section where you found the broken docker command? :) all the docs reside in https://github.com/ory/hydra/tree/master/docs

milenkozahovic commented 7 years ago

yeeeah no problem. thank you again. I think this should be fixed too.

milenkozahovic commented 7 years ago

Another problem occurs when i try following command:

docker exec -i -t e92543e0a50e /bin/bash

and got this error:

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory"

aeneasr commented 7 years ago

Oh yeah that needs to be /bin/sh

milenkozahovic commented 7 years ago

ok. it works now, the command should be:

docker exec -i -t e92543e0a50e /bin/sh

thank you

ballad89 commented 7 years ago
ubuntu@ip-172-31-57-106:~$ sudo docker ps
CONTAINER ID        IMAGE                                          COMMAND                  CREATED             STATUS              PORTS                    NAMES
5b49f071819b        oryd/hydra:v0.10.0-alpha.18                    "hydra host"             About an hour ago   Up About an hour    0.0.0.0:9000->4444/tcp   ory-hydra-example--hydra
e6697ba0787a        postgres:9.6                                   "docker-entrypoint..."   2 hours ago         Up 2 hours          5432/tcp                 ory-hydra-example--postgres
ubuntu@ip-172-31-57-106:~$ sudo docker exec -i -t 5b49f071819b /bin/sh
oci runtime error: exec failed: container_linux.go:265: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory"

I am getting this error, it seems there is now no shell at all in the image

aeneasr commented 7 years ago

Yes, you can't SSH in any more, but you can do docker exec -i -t 5b49f071819b help or any other hydra command.

ballad89 commented 7 years ago

Thanks, I got it to work with docker exec -i -t 5b49f071819b hydra help

TomGouderDV commented 5 years ago

Why was the ability to bash in removed?

aeneasr commented 5 years ago

you can create an image based on the 15mb hydra image with bash. hydra does not need bash so saving 400mb for full blown linux is the reason.

On 6. Sep 2019, at 13:04, Tom Gouder notifications@github.com wrote:

Why was the ability to bash in removed?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

TomGouderDV commented 5 years ago

Ah, understood - smart to remove it if it was so heavy previously 👍 Thanks for explaining!

Yeemonkyaw25 commented 4 years ago

I got this error when I run this command docker exec -i -t laradock_redis bash.