如何在本地为Circle CI映像模拟远程Docker?

时间:2018-10-02 00:03:50

标签: docker circleci

我正在尝试构建一个基本映像,Circle CI可使用该映像从ECS加载我的所有其他Docker映像。但是,在构建映像时,我无法在本地模拟远程docker环境。如何在CI中告诉它使用远程Docker,而在本地时如何告诉它使用本地Docker?

这是我的Docker文件

# This Docker image is solely for connecting to ECS and grabbing our other images

### Build & Push Command (Locally):
# Ask @tolicodes for what the AWS_ACCESS_KEY and AWS_SECRET_KEY are
# export AWS_ACCESS_KEY=XXX && export AWS_SECRET_KEY=XXX
# docker build --build-arg AWS_ACCESS_KEY=$AWS_ACCESS_KEY --build-arg AWS_SECRET_KEY=$AWS_SECRET_KEY -f docker_files/website-ci-base.Dockerfile -t xxx.dkr.ecr.us-east-1.amazonaws.com/website:website-ci-base . && docker push xxx.dkr.ecr.us-east-1.amazonaws.com/website:website-ci-base

FROM circleci/node:9.11.1-browsers

### ECS LOGIN

# Make sure that environmental variables can be accessed later
# Rename them to variables that AWS config can use
# Note: that we have to do the rename because someone specified the keys
# In the circle config with different names, and I don't want to mess with
# that -@tolicodes
ARG AWS_ACCESS_KEY
ARG AWS_SECRET_KEY
ENV AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY
ENV AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY

# Python is required by AWS CLI
RUN sudo apt-get update
RUN sudo apt-get install -y python-pip python-dev

# Install and log into CLI. Now we can use ECS
RUN sudo pip install awscli
RUN $(aws ecr get-login --no-include-email --region us-east-1)

我得到了错误

Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

0 个答案:

没有答案