I create the default test role by running molecule init scenario default
Then I run molecule test
Output from GitLab CI is as follows:
"stderr": "\u001b[31mERROR: Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon\u001b[0m\n\u001b[31mERROR: Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon\u001b[0m",
"stderr_lines": [
"\u001b[31mERROR: Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon\u001b[0m",
"\u001b[31mERROR: Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon\u001b[0m"
Molecule role is as follows:
- name: Create Default Role
command: molecule init scenario default
args:
chdir: roles/amazon_cloudwatch_agent
- name: Run Molecule Test
command: molecule --debug test
args:
chdir: roles/amazon_cloudwatch_agent
Solution was to redesign the gitlab-ci.yml file as so:
---
image: <insert desired image here>
services:
- docker:dind
stages:
- tests
before_script:
- docker -v
- python -V
- pip install --upgrade pip
- pip install molecule
- pip install -U requests==2.5.3
molecule-role-common:
stage: tests
tags:
- molecule
variables:
DOCKER_HOST: "tcp://docker:2375"
PY_COLORS: 1
script:
- cd roles/amazon_cloudwatch_agent; molecule init scenario --role-name amazon_cloudwatch_agent
- ls
- molecule --debug test
It seems having services: docker:dind is the key to get the docker image molecule runs connecting with the docker daemon.
While I am still having issues with the proxy, this has gotten me past the initial problem encountered.