docker: “build” requires 1 argument. See 'docker build --help'

前端 未结 14 2085
太阳男子
太阳男子 2020-11-28 02:21

Trying to follow the instructions for building a docker image from the docker website.

https://docs.docker.com/examples/running_redis_service/

this is the er

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 02:39

    In my case this error was happening in a Gitlab CI pipeline when I was passing multiple Gitlab env variables to docker build with --build-arg flags.

    Turns out that one of the variables had a space in it which was causing the error. It was difficult to find since the pipeline logs just showed the $VARIABLE_NAME.

    Make sure to quote the environment variables so that spaces get handled correctly.

    Change from:

    --build-arg VARIABLE_NAME=$VARIABLE_NAME
    

    to:

    --build-arg VARIABLE_NAME="$VARIABLE_NAME"
    

提交回复
热议问题