Build-arg parameter in docker build command

docker

#1

I’m trying to pass build-arg to the docker build but I’m getting this exception: 'docker: “build” requires 1 argument.'
On my dev environment this command is working and also when I connect via SSH to your machine it’s working and I can run this command.
This is what I’m trying to run: docker build --rm=false --build-arg GIT_RSA=$GIT_RSA -t build_name:$CIRCLE_BRANCH .


#2

Can you try removing the build_name aspect? Maybe also try replacing the env vars with text to guarantee that’s not causing any issues.


#3

The build name is just something that I wrote instead of the repo name. The env vars are also not the case because when I ssh the machine I can run the same line and it’s working.
I think there is an issue with the how the yaml transfer the line of code to the command line.


#4

That’s extremely odd. Can you link us to that? You can PM me instead of sharing it publicly.

Another thing to try would be to put it in a shell script and just call that script.


#5

I use an online yaml parser to check how some yaml lines serialize. It’s possible that colon in your Docker command is forcing that line to get treated as a map/dictionary with the colon. If that’s the case, you can quote the whole command to force it to a YAML string.


#6