Job service command

It seems like one cannot give a command for the container (CMD) to docker when a given service is created, am i missing something here ?

5 Likes

I guess once you understand that docker run = docker create + docker start then it kinda make sense :wink: I did not realize the diff between the 2.

However the same question remains, Github automatically start the created container and it does not seem there is any way to pass some command to the start command.

2 Likes

Have you found any solution or alternatives yet? I’m tring to use host a minio instance ( https://hub.docker.com/r/minio/minio/ ) and it requires a command.

EDIT:  my temporary solution was to create a new docker image from minio and set the parameters on the Dockerfile. Source: https://github.com/getfider/docker-images/blob/master/minio.Dockerfile

Thanks.

I tried:

services:
      redis:
        image: redis
        options: --entrypoint "redis-server" redis redis.conf

where redis is the plain image name to reenact the “entrypoint override and cmd override pattern” but with no luck as it seems, the logs saying:

docker.io/library/redis:latest

/usr/bin/docker create --name 6da951dbb37f428fad35502c37537d1b_redis_5368d1 --label 671ee6 --network github_network_8488180e899a4f81b0413c82bc4db451 --network-alias redis --entrypoint "redis-server" redis redis.conf -e GITHUB_ACTIONS=true redis

which to me looks as if the cmd part (… redis redis.conf …) simply is ignored regarding the last “redis” occurrence in the command line.

I was also stuck with the problem. My use case is to launch the pubsub emulator using the cloud SDK docker image, which amounts to the following command:

docker run -d -p 8085:8085 gcr.io/google.com/cloudsdktool/cloud-sdk gcloud beta emulators pubsub start --host-port=0.0.0.0:8085

The image contains many functionalities. As a natural consequence, we need to override CMD.