Docker 和 CircleCI 2.0 的高 uid 错误问题
High uid error issue with Docker and CircleCI 2.0
我正在尝试使用 Circle Ci 构建持续集成流程。当我将我的代码推送到 github 时,流程开始,但因错误而停止:
Build-agent version 0.0.4071-34fe4dc (2017-09-05T01:33:40+0000)
Starting container micheleminno/elasticsearch:latest
image cache not found on this host, downloading micheleminno/elasticsearch:latest
latest: Pulling from micheleminno/elasticsearch
42a816b9ad19: Pull complete
5dabff016c33: Pull complete
e22082c539e8: Pull complete
57845aa0da23: Pull complete
3da62a3688f0: Pull complete
bce992ca3d80: Pull complete
2734c785c0d8: Pull complete
08cbf6dbba97: Pull complete
750b60032fcc: Pull complete
Digest: sha256:f07025f1da82ea87e70cac194929953a245ae4560086471c90b1756693246ec4
Status: Downloaded newer image for micheleminno/elasticsearch:latest
using image micheleminno/elasticsearch@sha256:f07025f1da82ea87e70cac194929953a245ae4560086471c90b1756693246ec4
Starting container mysql:5.5
using image mysql@sha256:7674d74d9f010b1500c1ae38f7af90014145ee3c92ddd65dd2e1edfd8c61270f
Starting container micheleminno/db-migrations
image cache not found on this host, downloading micheleminno/db-migrations
latest: Pulling from micheleminno/db-migrations
c89e59f636b6: Pull complete
cfb692fa93ee: Pull complete
d607b85c45a1: Pull complete
0150b9c56763: Pull complete
CircleCI was unable to start the container because of a userns remapping failure in Docker.
This typically means the image contains files with UID/GID values that are higher than Docr and CircleCI can use.
Checkout our docs https://circleci.com/docs/2.0/high-uid-error/ to learn how to fix this problem.
Original error: failed to register layer: Error processing tar file(exit status 1): Container ID 5924152 cannot be mapped to a host ID
我按照 link 并按照那里的建议进行操作,但我找不到任何具有该 ID 的内容。
这是我的配置圈 yml 文件:
version: 2
jobs:
build:
docker:
- image: micheleminno/elasticsearch:latest
- image: mysql:5.5
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: real-affinities-test
MYSQL_USER: development
MYSQL_PASSWORD: development
- image: micheleminno/db-migrations
environment:
- NODE_ENV: development
working_directory: ~/
steps:
- checkout
- run:
name: Build real-affinities and run tests
command: docker-compose -f docker-compose.test.yml -p ci up --build
2017 年 9 月 9 日更新:
我按照@FelicianoTech 的建议直接在 Dockerfile 中更改文件的所有权,更新了导致高 uids 问题的项目的 Dockerfile:
FROM node:8.1.4-alpine
WORKDIR /app
# add package.json and run npm install before adding the rest of the files
# this way, you only run npm install when package.json changes
ADD package.json /app
RUN npm install
# add the rest of the files
ADD . /app
# change ownership recursively of all files
RUN chown root:root . -R
CMD ["./node_modules/.bin/knex", "migrate:latest"]
但问题依旧。
问题出在第三张 Docker 图片 micheleminno/db-migrations
上。如果您 运行 本地图像,并且 运行 此命令:
ls -lah /app/node_modules/
您会看到几个目录的用户 ID 高于 65534。这就是问题所在。将这些 ID 更改为更低的 ID 以解决此问题。
我正在尝试使用 Circle Ci 构建持续集成流程。当我将我的代码推送到 github 时,流程开始,但因错误而停止:
Build-agent version 0.0.4071-34fe4dc (2017-09-05T01:33:40+0000)
Starting container micheleminno/elasticsearch:latest
image cache not found on this host, downloading micheleminno/elasticsearch:latest
latest: Pulling from micheleminno/elasticsearch
42a816b9ad19: Pull complete
5dabff016c33: Pull complete
e22082c539e8: Pull complete
57845aa0da23: Pull complete
3da62a3688f0: Pull complete
bce992ca3d80: Pull complete
2734c785c0d8: Pull complete
08cbf6dbba97: Pull complete
750b60032fcc: Pull complete
Digest: sha256:f07025f1da82ea87e70cac194929953a245ae4560086471c90b1756693246ec4
Status: Downloaded newer image for micheleminno/elasticsearch:latest
using image micheleminno/elasticsearch@sha256:f07025f1da82ea87e70cac194929953a245ae4560086471c90b1756693246ec4
Starting container mysql:5.5
using image mysql@sha256:7674d74d9f010b1500c1ae38f7af90014145ee3c92ddd65dd2e1edfd8c61270f
Starting container micheleminno/db-migrations
image cache not found on this host, downloading micheleminno/db-migrations
latest: Pulling from micheleminno/db-migrations
c89e59f636b6: Pull complete
cfb692fa93ee: Pull complete
d607b85c45a1: Pull complete
0150b9c56763: Pull complete
CircleCI was unable to start the container because of a userns remapping failure in Docker.
This typically means the image contains files with UID/GID values that are higher than Docr and CircleCI can use.
Checkout our docs https://circleci.com/docs/2.0/high-uid-error/ to learn how to fix this problem.
Original error: failed to register layer: Error processing tar file(exit status 1): Container ID 5924152 cannot be mapped to a host ID
我按照 link 并按照那里的建议进行操作,但我找不到任何具有该 ID 的内容。
这是我的配置圈 yml 文件:
version: 2
jobs:
build:
docker:
- image: micheleminno/elasticsearch:latest
- image: mysql:5.5
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: real-affinities-test
MYSQL_USER: development
MYSQL_PASSWORD: development
- image: micheleminno/db-migrations
environment:
- NODE_ENV: development
working_directory: ~/
steps:
- checkout
- run:
name: Build real-affinities and run tests
command: docker-compose -f docker-compose.test.yml -p ci up --build
2017 年 9 月 9 日更新:
我按照@FelicianoTech 的建议直接在 Dockerfile 中更改文件的所有权,更新了导致高 uids 问题的项目的 Dockerfile:
FROM node:8.1.4-alpine
WORKDIR /app
# add package.json and run npm install before adding the rest of the files
# this way, you only run npm install when package.json changes
ADD package.json /app
RUN npm install
# add the rest of the files
ADD . /app
# change ownership recursively of all files
RUN chown root:root . -R
CMD ["./node_modules/.bin/knex", "migrate:latest"]
但问题依旧。
问题出在第三张 Docker 图片 micheleminno/db-migrations
上。如果您 运行 本地图像,并且 运行 此命令:
ls -lah /app/node_modules/
您会看到几个目录的用户 ID 高于 65534。这就是问题所在。将这些 ID 更改为更低的 ID 以解决此问题。