I have a shell script for pulling, retagging, building and pushing my docker images and it works great when I run it locally. But when CI runs it I get an error
:ash :stable uknown operand. I think it has to do something with different distributive of Linux used by my gilab runner. I am running on Ubuntu 18.04. And I am not sure what linux is on CI, I created as a docker gitlab runner. Here is my script:
docker pull $BACKEND_DOCKER_IMAGE_PATH:latest &> /dev/null if [[ -n `docker images | grep "$BACKEND_DOCKER_IMAGE_PATHb" | grep "latestb"` ]]; then docker tag $BACKEND_DOCKER_IMAGE_PATH:latest $BACKEND_DOCKER_IMAGE_PATH:stable; fi docker build . -f Dockerfile.api -t $BACKEND_DOCKER_IMAGE_PATH:latest docker push $BACKEND_DOCKER_IMAGE_PATH:latest if [[ -n `docker images | grep "$BACKEND_DOCKER_IMAGE_PATHb" | grep "stableb"` ]]; then docker push $BACKEND_DOCKER_IMAGE_PATH:stable; fi
Could anyone please give me a hint what I could do in order to make this work or achieve the same result differently? I have a feeling it has to do something with quoting, but I don’t understand shell much.