wasp256
wasp256

Reputation: 6242

gitlab CI create docker image and push to AWS

I setup a docker registry (ECR) on AWS. From my gitlab repository I'd like to setup a CI to automatically create images and push them to the repository. I was following the following tutorial to setup everything, but when running the example, I receive the error

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

My yml file looks like this

image: docker:latest

variables:
  REPOSITORY_URL: <aws-url>/<registry>/outsite-slackbot

services:
  - docker:dind

before_script:
  - apk add --no-cache curl jq python py-pip
  - pip install awscli

stages:
  - build

build:
  stage: build
  script:
    - $(aws ecr get-login --no-include-email --region eu-west-1)

Upvotes: 0

Views: 1154

Answers (1)

Mehdi Hosseini
Mehdi Hosseini

Reputation: 2147

There is no problem with the Dockerfile, you can't be connected to docker daemon by the way. So check these steps:

  • Are you logged in as a root? (sudo su or sudo -i)
  • Start Docker service (service docker start)

Then follow the tutorial :)

Upvotes: 2

Related Questions