Create custom docker image

If you need to build a custom docker image with own configuration:

create a directory:
mkdir my-hydra
cd my-hydra
copy your config.yml file here
create a Dockerfile

FROM oryd/hydra:latest
COPY config.yml /
ENTRYPOINT [“hydra”]
CMD [“serve”, “all”, “–dangerous-force-http”, “–config” , “/config.yml”]

create a docker-compose:
$ cat docker-demo.yml
version: ‘3’

services:

hydra:
image: sso-demo-hydra:latest
container_name: sso-demo-hydra
ports:
- “4444:4444” # Public port
- “4445:4445” # Admin port
- “5555:5555” # Port for hydra token user
command:
serve all --dangerous-force-http --config /config.yml
environment:
- URLS_SELF_ISSUER=http://127.0.0.1:4444
- URLS_CONSENT=http://localhost:8087/v1/consent
- URLS_LOGIN=http://localhost:8087/v1/login
- URLS_LOGOUT=http://localhost:8087/v1/logout
- DSN=memory
- SECRETS_SYSTEM=IamTheOnlyAuthProviderArround1
- OIDC_SUBJECT_TYPES_SUPPORTED=public,pairwise
- OIDC_SUBJECT_TYPE_PAIRWISE_SALT=AndThisIsMySaltedConfig
restart: unless-stopped

build the image:
$ docker build -t sso-demo-hydra .

build container:
$ cat docker-demo.yml
version: ‘3’

services:

hydra:
image: sso-demo-hydra:latest
container_name: sso-demo-hydra
ports:
- “4444:4444” # Public port
- “4445:4445” # Admin port
- “5555:5555” # Port for hydra token user
command:
serve all --dangerous-force-http --config /config.yml
environment:
- URLS_SELF_ISSUER=http://127.0.0.1:4444
- URLS_CONSENT=http://localhost:8087/v1/consent
- URLS_LOGIN=http://localhost:8087/v1/login
- URLS_LOGOUT=http://localhost:8087/v1/logout
- DSN=memory
- SECRETS_SYSTEM=IamTheOnlyAuthProviderArround1
- OIDC_SUBJECT_TYPES_SUPPORTED=public,pairwise
- OIDC_SUBJECT_TYPE_PAIRWISE_SALT=AndThisIsMySaltedConfig
restart: unless-stopped

2 Likes

Nice!!! Thanks.

1 Like