Deploy docker to docker-machine on host

I have gitlab-runner running in a docker container.

I have a build step building my application and a Dockerfile in the ‘Docker’ folder, followed by the following deploy step:

deploy:
  image: docker:latest
  stage: deploy
  script:
    - 'cd Docker'
    - 'pwd'
    - 'docker build -t xxx/myapp .'

However, the last step fails with:

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

Is it possible to build, deploy and run a docker image on the host (or other remote docker), or will I need to install the runner locally on the docker host to do so?

I found out I was missing the --docker-privileged flag.

But now I need to solve being able to copy files from one step to another. I can see that this can be accomplished by artifacts, so I tried adding the ‘output’ folder from my dotnet build. However, when I do, I get the following error:

Docker/output/*.*: found 132 matching files        
Uploading artifacts...
ERROR: Uploading artifacts to coordinator... error  error=couldn't execute POST against http://gitlab/ci/api/v1/builds/44/artifacts?: Post http://gitlab/ci/api/v1/builds/44/artifacts?: write tcp 172.17.0.18:39916->192.168.1.228:80: write: broken pipe id=44 token=vtSSsGPD
WARNING: Retrying...                               
ERROR: Uploading artifacts to coordinator... error  error=couldn't execute POST against http://gitlab/ci/api/v1/builds/44/artifacts?: Post http://gitlab/ci/api/v1/builds/44/artifacts?: write tcp 172.17.0.18:39920->192.168.1.228:80: write: broken pipe id=44 token=vtSSsGPD
WARNING: Retrying...                               
ERROR: Uploading artifacts to coordinator... error  error=couldn't execute POST against http://gitlab/ci/api/v1/builds/44/artifacts?: Post http://gitlab/ci/api/v1/builds/44/artifacts?: write tcp 172.17.0.18:39936->192.168.1.228:80: write: broken pipe id=44 token=vtSSsGPD
FATAL: invalid argument                            
ERROR: Build failed: exit code 1

I tried with a single empty .txt file, and that worked fine.

Any ideas behind this error?

How big is the artifact?

334MB in total. I’ve increased the allowed limit to 1000MB though.

And if you would fake stuff with a large file like that? So you can at least rule any upload issues.

Certainly something I can try…