Build failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Dave Bown's Avatar

Dave Bown

16 Nov, 2018 12:54 PM

Hi some of our jobs have started failing when executing docker build commands

e.g. sudo docker build -t someimage:latest -t someimage:$APPVEYOR_BUILD_VERSION .

Nothing has changed recently and this has definitely worked previously lots of times.

  1. 1 Posted by Dave Bown on 16 Nov, 2018 12:55 PM

    Dave Bown's Avatar

    Oops should have said we're running this on an 'Ubuntu' environment.

  2. Support Staff 2 Posted by Ilya Finkelshte... on 16 Nov, 2018 11:18 PM

    Ilya Finkelshteyn's Avatar

    This is probably side effect of recent Ubuntu image update. Please use respective "previous" image while we are investigating. Also please subscribe to "Technical updates" at https://ci.appveyor.com/notifications to decrease number of surprises like this. It is safe, we send only important technical info and not that often.

  3. 3 Posted by Dave Bown on 17 Nov, 2018 10:14 AM

    Dave Bown's Avatar

    Just tried switching to the "Previous Ubuntu" image on one of the job and i still get the same error.

  4. 4 Posted by Dave Bown on 17 Nov, 2018 10:15 AM

    Dave Bown's Avatar

    I have subscribed to technical notifications as you requested also.

  5. Support Staff 5 Posted by Wasa Pleshakov on 17 Nov, 2018 01:49 PM

    Wasa Pleshakov's Avatar

    Do you enable docker in the image with services: docker in appveyor.yml as it described in https://www.appveyor.com/docs/getting-started-with-appveyor-for-lin... ?

  6. 6 Posted by Dave Bown on 17 Nov, 2018 08:38 PM

    Dave Bown's Avatar

    No, never been necessary, and unfortunately we're not using appveyor.yml files and configure things using the UI. Docker doesn't appear in the Services drop down list on the environment tab in settings unfortunately. Is this something you can add?

  7. 7 Posted by tadly on 18 Nov, 2018 07:48 AM

    tadly's Avatar

    Having the same issue and I do have docker enabled in my appveyor.yaml

    For reference:
    Here's my appveyor.yaml and here's the failing build

  8. Support Staff 8 Posted by Wasa Pleshakov on 19 Nov, 2018 10:38 AM

    Wasa Pleshakov's Avatar

    Dave, I'm not UI guy, but I think it is possible to add docker in Services dropdown. I'll back to you with this after some internal discussion.
    Another way to fix this issue is add sudo service docker start command right before your sudo docker build ... command.

  9. Support Staff 9 Posted by Wasa Pleshakov on 19 Nov, 2018 10:50 AM

    Wasa Pleshakov's Avatar

    Tadly,
    From the failing build log, I see that you run docker build ... on install phase of the build. Our build pipeline run install scripts first (step #4) then starts services (step #7).
    To fix this issue you can add sudo service docker start in your install script:

    install:
      - sh: |
          sudo service docker start
          docker build -f data/docker/Dockerfile.${DIST} \
            --pull --tag linuxwhatelse/dups-${DIST} .
    
    Or you can move your docker build ... from install step to before_build step:
    before_build:
      - sh: |
          docker build -f data/docker/Dockerfile.${DIST} \
            --pull --tag linuxwhatelse/dups-${DIST} .
    
    In my opinion, the second way looks more logical.
  10. 10 Posted by tadly on 19 Nov, 2018 11:01 AM

    tadly's Avatar

    Yeah, I also like the second option much better.
    Guess the build pipeline changed recently in this regard.

    Anyways. Fixed now, thanks :)

  11. 11 Posted by Dave Bown on 19 Nov, 2018 11:04 AM

    Dave Bown's Avatar

    I've added the 'sudo service docker start' to my install script. The docker build actions are actually in the 'After build script', according to the UI anyway.

    I've queued a build, we'll see what happens.

  12. 12 Posted by Dave Bown on 19 Nov, 2018 11:08 AM

    Dave Bown's Avatar

    It failed but I now realise I'm actually wrong, this must be the one and only build job where we are actually running with an appveyor.yml file, hence none of my ui changes have taken affect. I'll modify the yml file and hopefully that will fix it, I'm reasonably confident that this will solve it and I'd have actually found the solution earlier if I'd known that none of my changes were working.

  13. 13 Posted by Dave Bown on 19 Nov, 2018 11:35 AM

    Dave Bown's Avatar

    Thanks for your advice adding the following to the yml file as you suggested solve the problem.

    services:
    - docker

    Clearly the project was setup using the UI initially but changed exported to a yml file later.

    So my two pieces of feedback on this ticket are:
    1. Would be really good to get the Docker option in the services combo box in the ui asap if possible because most of our builds are configured using the UI.
    2. How do you know for sure if the build is using a yml file or the settings in the UI? Does the UI currently address this in someway I've missed? Or could this be improved?

  14. 14 Posted by Florian Feldhau... on 26 Nov, 2018 03:53 PM

    Florian Feldhaus's Avatar

    One more question. Is it possible to only enable the docker service for specific build configurations?

  15. 15 Posted by Dave Bown on 26 Nov, 2018 03:54 PM

    Dave Bown's Avatar

    Hi, I'm away on annual leave till Monday 26th of November. I will not be regularly checking my email or contactable by phone. If you need assistance you can log support tickets using your Office 365 account at https://myday.freshdesk.com, Alterantively e-mail [email blocked] or telephone 0845 050 7380. Best regards Dave Bown Technical Director, Collabco Software

  16. Support Staff 16 Posted by Owen McDonnell on 26 Nov, 2018 06:10 PM

    Owen McDonnell's Avatar

    @Florian, You should be able to achieve this with for: construct.

    for:
      -
         matrix:
           only:
             - configuration: <your-configuration>
    
         services:
           - mssql2016
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac