Docker command in node

Hi all

I’m trying to set up my CI/CD pipeline, but without any success.

In a nutshell:

  • I would like to build a docker image
  • Then as a next step use semantic-release to tag the container with the correct release version

gitlab-ci.yml:
image: docker:19.03.8

stages:
- build
- release

variables:
  # When using dind service, we need to instruct docker, to talk with
  # the daemon started inside of the service. The daemon is available
  # with a network connection instead of the default
  # /var/run/docker.sock socket. docker:19.03.1 does this automatically
  # by setting the DOCKER_HOST in
  # https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03.1/docker-entrypoint.sh#L23-L29
  #
  # The 'docker' hostname is the alias of the service container as described at
  # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
  #
  # Note that if you're using GitLab Runner 12.7 or earlier with the Kubernetes executor and Kubernetes 1.6 or earlier,
  # the variable must be set to tcp://localhost:2376 because of how the
  # Kubernetes executor connects services to the job container
  # DOCKER_HOST: tcp://localhost:2376
  #
  # Specify to Docker where to create the certificates, Docker will
  # create them automatically on boot, and will create
  # `/certs/client` that will be shared between the service and job
  # container, thanks to volume mount from config.toml
  DOCKER_TLS_CERTDIR: "/certs"
  
services:
  - docker:19.03.8-dind

before_script:
  - docker info

docker-build:
  stage: build
  script:
    - docker build .

release:
  image: node:latest
  stage: release
  services:
    - docker:19.03.8-dind
    - docker:19.03.8
  before_script:
    - ls -la
    - node -v
    - npm install --target_arch=x64 --target_platform=linux
    - docker -v
  script:
    - npx semantic-release

Current setup: