I was referring to the guide here to access the Docker daemon in a Codefresh step.
This is the thread I referred to before starting this issue: Shared volumes in freestyle composition - #12 by rsung
The reason for doing this is in our tests, we have a Docker in Docker setup (we wanted to try this out), so in the test itself we need to connect to the Docker daemon to pull additional images. I would rather not install Docker in the image directly as I read there are many issues that may arise.
My codefresh.yml file:
version: '1.0'
build_version: 'v2'
mode: parallel
stages:
- setup
- test
steps:
main_clone:
title: Cloning main repository...
type: git-clone
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
revision: '${{CF_REVISION}}'
build_builder:
type: build
stage: setup
title: Build builder image
dockerfile: Dockerfile
image_name: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}-builder
disable_push: true
tag: latest
when:
steps:
- name: main_clone
on:
- success
test:
title: Run tests
type: composition
stage: test
working_directory: ${{main_clone}}
environment:
- GOPATH=/codefresh/volume/.go
composition:
version: '2'
composition_candidates:
run-test:
image: ${{build_builder}}
command: ./test.sh
volumes: # Volumes required to run DIND and to mount your Repository
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker:/var/lib/docker
- ${{CF_VOLUME_NAME}}:/codefresh/volume
when:
steps:
- name: build_builder
on:
- success
I got the following errors:
Cannot start composition with warnings ["Volume mapping is not supported, try
use: /var/run/docker.sock","Volume mapping is not supported, try use: /var/lib/doc
ker"]
I am not sure if it is one of the following reasons:
- I’m using composition wrongly or my codefresh.yml syntax is wrong
- Volume mapping is no longer supported in composition steps, OR
- Accessing the Docker daemon is no longer supported in composition steps.