我该如何解决"crontab: your UID isn't in the passwd file. bailing out."?
How can I solve "crontab: your UID isn't in the passwd file. bailing out."?
您好,我正在使用 Docker
和 whenever 编写 cron 计划规则,但是当我在我的 docker 容器中 运行 whenever --update-crontab
时出现此错误正在给我看。
crontab: your UID isn't in the passwd file.
bailing out.
[fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid.
Docker文件
FROM ruby:2.4.1-slim
RUN apt-get update && apt-get -y install cron
ENV RAILS_ENV production
ENV INSTALL_PATH /app
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile.lock ./
RUN bundle install --binstubs --jobs 20 --retry 5
COPY . .
RUN chown -R nobody:nogroup /app
USER nobody
# use docker run -it --entrypoint="" demo "ls -la" to skip
EXPOSE 3000
CMD puma -C config/puma.rb
Docker版本:Docker version 17.05.0-ce, build 89658be
我的Docker撰写文件
chatbot_web:
container_name: chatbot_web
depends_on:
- postgres
- chatbot_redis
- chatbot_lita
user: "1000:1000"
build: .
image: dpe/chatbot
ports:
- '3000:3000'
volumes:
- '.:/app'
restart: always
我该如何解决这个问题?
编辑:
当我使用:
host$ docker run -it dpe/chatbot bash
container $ whenever --update-cron
[write] crontab file updated
有效,但当我使用时:
host$ docker exec -it chatbot_web bash
I have no name!@352c6a7500d2:/app$ whenever --update-cron
crontab: your UID isn't in the passwd file.
bailing out.
[fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid.
不工作=(
为了修复,我在 Dockerfile 和 docker-compose
中使用相同的用户
Docker文件
RUN chown -R nobody:nogroup /app
USER nobody
Docker撰写
chatbot_web:
user: "nobody:nogroup"
您好,我正在使用 Docker
和 whenever 编写 cron 计划规则,但是当我在我的 docker 容器中 运行 whenever --update-crontab
时出现此错误正在给我看。
crontab: your UID isn't in the passwd file.
bailing out.
[fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid.
Docker文件
FROM ruby:2.4.1-slim
RUN apt-get update && apt-get -y install cron
ENV RAILS_ENV production
ENV INSTALL_PATH /app
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile.lock ./
RUN bundle install --binstubs --jobs 20 --retry 5
COPY . .
RUN chown -R nobody:nogroup /app
USER nobody
# use docker run -it --entrypoint="" demo "ls -la" to skip
EXPOSE 3000
CMD puma -C config/puma.rb
Docker版本:Docker version 17.05.0-ce, build 89658be
我的Docker撰写文件
chatbot_web:
container_name: chatbot_web
depends_on:
- postgres
- chatbot_redis
- chatbot_lita
user: "1000:1000"
build: .
image: dpe/chatbot
ports:
- '3000:3000'
volumes:
- '.:/app'
restart: always
我该如何解决这个问题?
编辑: 当我使用:
host$ docker run -it dpe/chatbot bash
container $ whenever --update-cron
[write] crontab file updated
有效,但当我使用时:
host$ docker exec -it chatbot_web bash
I have no name!@352c6a7500d2:/app$ whenever --update-cron
crontab: your UID isn't in the passwd file.
bailing out.
[fail] Couldn't write crontab; try running `whenever' with no options to ensure your schedule file is valid.
不工作=(
为了修复,我在 Dockerfile 和 docker-compose
中使用相同的用户Docker文件
RUN chown -R nobody:nogroup /app
USER nobody
Docker撰写
chatbot_web:
user: "nobody:nogroup"