~sircmpwn/builds.sr.ht#223: 
Docker Usage

Hello there ! I'm trying to auto build my projects docker images using builds.sr.ht

https://hg.sr.ht/~reedwade/blog-service/browse/default/.build.yml

Sadly I got

+ docker image build -t eluminae/blog-website:php-default ./
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Which seems totally normal.

I cannot found informations about it. How can I use docker in the builds context ?

Ty by advance Ps: I love sr.ht !

Status
RESOLVED INVALID
Submitter
~reedwade
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.

~sircmpwn REPORTED INVALID 2 years ago

Install and start the docker service in your container, same way you install and use docker on any other machine.

However, as a temporary workaround for a networking issue, note that you need to start dockerd with --bip 172.18.0.1/16

~reedwade 2 years ago

Install and start the docker service in your container, same way you install and use docker on any other machine.

Okay I tried

systemctl start docker.service

But it did not work. I'll try

dockerd

However, as a temporary workaround for a networking issue, note that you need to start dockerd with --bip 172.18.0.1/16

Yes I saw it on other todos about docker.

Thank a lot ! :D

~reedwade 2 years ago

To later:

A working way

- build: |
    sudo nohup dockerd --bip 172.18.0.1/16 &
    sleep 10
    cd blog-service
    sudo docker image build -t eluminae/blog-service:default ./

~reedwade 2 years ago

A final working way:

---
arch: null
image: archlinux
packages:
  - docker
repositories: null
secrets:
  - 42997b90-3718-4c7e-8dfd-b7109c22b366
environment:
  DOCKER_USER: 'eluminae'
sources:
  - hg+https://hg.sr.ht/~reedwade/blog-service
tasks:
  - build: |
      sudo nohup dockerd --bip 172.18.0.1/16 &
      sleep 10
      cat ~/docker_password | sudo docker login -u "$DOCKER_USER" --password-stdin=true
      cd blog-service
      sudo docker image build -t eluminae/blog-service:default ./
      sudo docker tag eluminae/blog-service:default eluminae/blog-service:latest
      sudo docker push eluminae/blog-service:default
      sudo docker push eluminae/blog-service:latest
triggers: null

# vim:ts=2:sw=2:sts=2

~remyabel 2 years ago

Are these instructions up-to-date? I added the dockerd invocation but run into the same issue: https://builds.sr.ht/~remyabel/job/80651 But maybe I missed something obvious.

~xaffe 2 years ago

@remyabel I think you need to mount tempfs before. Have a look at my docker setup file that works nicely:

https://git.sr.ht/~xaffe/takingstack/tree/develop/files/setup-docker.sh

~remyabel 2 years ago

@xaffe Thanks for the suggestion. In addition with that, I needed sudo service cgroups start.

Register here or Log in to comment, or comment via email.