Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker build fails in Travis CI - "Error checking context: 'syntax error in pattern'"

I have a .NET Core 2.1 project which I am building with Docker in Travis CI after running tests on it. The relevant parts (I think) of my travis build:

.travis.yml:

deploy:
  - provider: script
    script: ./deploy.sh $TRAVIS_TAG $DOCKER_USERNAME $DOCKER_PASSWORD
    skip_cleanup: true
    on:
      tags: true

deploy.sh:

#!/bin/bash
set -ev

TAG=$1
DOCKER_USERNAME=$2
DOCKER_PASSWORD=$3
echo "$TAG"
echo "$DOCKER_USERNAME"
echo "$DOCKER_PASSWORD"
docker build -t $DOCKER_USERNAME/rpthreadtrackerv3.backend .
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
docker push $DOCKER_USERNAME/rpthreadtrackerv3.backend:latest

I'm still pretty new to Docker so I'm pretty sure I'm doing something obvious wrong, but nevertheless, when the deploy step in my build runs, the output is:

enter image description here

What's bewildering is that I'm pretty sure that this worked once and then stopped working.

Also, running

docker build -t $DOCKER_USERNAME/rpthreadtrackerv3.backend .

from my local command line works perfectly fine.

Google is completely silent on what this error message could mean and no one in the world seems to have encountered it but me so I'm a little baffled. What might be causing docker build to fail this way in Travis?

like image 273
rosalindwills Avatar asked Aug 17 '18 05:08

rosalindwills


1 Answers

For those curious, this turned out to be the system's way of telling me that it was erroring on trying to do regex matching on the items in my .dockerignore file (i.e. that file had syntax errors in it -- in this case, I had backslashes instead of forward slashes on my file paths). Nice and cryptic; I had to dig through the Docker source code to figure out what was happening.

Hopefully this helps someone else encountering the same issue! :)

like image 158
rosalindwills Avatar answered Nov 15 '22 07:11

rosalindwills