这是扼杀我,找不到答案.我只是想将当前用户从根更改为预先创建的名为“节点”的用户,给出“节点:9”的基本图像。
下面是我现在拥有的. .circleci/config.yml文件:
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:9
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
- restore_cache: # Download and cache dependencies
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: sudo npm install --loglevel=warn
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# run tests!
- run: echo "here are the tests"下面是您如何处理Docker的方法:
RUN echo "newuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN useradd -ms /bin/bash newuser
USER newuser但我相信节点:9张图片附带了一个预先创建的用户,所以可以简单地说:
USER node
WORKDIR /home/node/app,但我找不到任何关于如何从根用户更改为CircleCI.的非根用户的文档。
下面是一些文档:https://circleci.com/docs/2.0/configuration-reference/
发布于 2018-05-21 16:42:53
可以使用user参数在image部分中选择在停靠器映像中运行的可用用户。
docker:
- image: circleci/node:9
user: nodehttps://stackoverflow.com/questions/50320263
复制相似问题