How can I solve “crontab: your UID isn't in the passwd file. bailing out.”?

Hi I’m using Docker and whenever to write cron schedule rules, but when I run whenever --update-crontab in my docker container this errors is showing to me.

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 'scale' command is not scaling across multiple machines
  • Container spawning for interactive tutorial
  • NGINX as reverse proxy on another container - how to configure the config files
  • Dockerfiles to run AEM subsystems in containers
  • Docker and netstat: netstat is not showing ports, exposed by docker containers
  • Running the WSO2 Application Manager docker image with custom configuration
  • 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 Version: Docker version 17.05.0-ce, build 89658be

    My Docker compose file

      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
    

    How can I solve this?

    EDIT:
    When I use:

    host$ docker run -it dpe/chatbot bash
    container $ whenever --update-cron
    [write] crontab file updated
    

    Works, but when I use:

    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.
    

    Don’t Work =(

  • docker-compose v3 share the same volume mount locations between multiple containers
  • What does virtual size of docker image mean?
  • Dockerfile: mkdir and COPY commands run fine but I can't see the directory and file
  • Zabbix server and agent using dns with docker swarm 1.12- connection problems
  • How to update a Docker container from a newer image?
  • How to run Redis on Docker using docker-compose.yml?
  • One Solution collect form web for “How can I solve “crontab: your UID isn't in the passwd file. bailing out.”?”

    To fix I use same user in Dockerfile and docker-compose

    Dockerfile

    RUN chown -R nobody:nogroup /app
    USER nobody
    

    Docker Compose

      chatbot_web:
        user: "nobody:nogroup"
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.