title: No such file or directory @ rb_sysopen sidekiq.pid on Docker Rails app
body: <p>I am trying to make it work rails dockerized project containers inside EC2 AWS and I am running without success.</p>
  
  <p>the RoR project depends on sidekiq, postgres and redis, so I builded a 'production image' with docker for rails (web service), and sidekiq (sidekiq service), and currently I try to make it work with docker-compose for production </p>
  
  <p>I have to say, everything in my local machine work fine. develop and 'production' images work as expected, the problem appears when compose up the 'production' images (web and sidekiq) in EC2 AWS machine.</p>
  
  <p>I am getting this error:</p>
  
  <pre><code>production_sidekiq | No such file or directory @ rb_sysopen - /my_app/tmp/pids/sidekiq.pid
  production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `initialize'
  production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `open'
  production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:370:in `write_pid'
  production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/lib/sidekiq/cli.rb:43:in `parse'
  production_sidekiq | /usr/local/bundle/gems/sidekiq-4.2.10/bin/sidekiq:11:in `&lt;top (required)&gt;'
  production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `load'
  production_sidekiq | /usr/local/bundle/bin/sidekiq:23:in `&lt;top (required)&gt;'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `load'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli/exec.rb:28:in `run'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:424:in `exec'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:27:in `dispatch'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/cli.rb:18:in `start'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/exe/bundle:30:in `block in &lt;top (required)&gt;'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
  production_sidekiq | /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.16.6/exe/bundle:22:in `&lt;top (required)&gt;'
  production_sidekiq | /usr/local/bin/bundle:23:in `load'
  production_sidekiq | /usr/local/bin/bundle:23:in `&lt;main&gt;'
  </code></pre>
  
  <p>In my docker-compose.yml for production on EC2 I have this:</p>
  
  <pre><code>version: '3'
  
  services:
    postgres:
      image: postgres:10.5
      environment: 
        POSTGRES_DB: my_app_production
      env_file:
        - ~/production.env
  
    redis:
      image: redis:4.0.11
  
    web:
      container_name: prod_web
      image: prod_my_app:latest
      command: bundle exec rails server -p 3000 -b '0.0.0.0' -e production
      ports:
        - '80:3000'
      depends_on:
        - postgres
        - redis
      environment: 
        RAILS_ENV: production 
        RACK_ENV: production 
        RAILS_LOG_TO_STDOUT: 'true' 
        RAILS_SERVE_STATIC_FILES: 'true' 
        EXECJS_RUNTIME: Disabled 
        SECRET_KEY_BASE: token 
        DEVISE_SECRET_KEY: token 
      env_file:
        - ~/production.env
      restart: always
  
    sidekiq:
      container_name: production_sidekiq
      image: prod_my_app_sidekiq:latest
      command: bundle exec sidekiq -C config/sidekiq.yml
      depends_on:
        - postgres
        - redis
      environment: 
        RAILS_ENV: production 
        RACK_ENV: production 
        RAILS_LOG_TO_STDOUT: 'true' 
        RAILS_SERVE_STATIC_FILES: 'true' 
        EXECJS_RUNTIME: Disabled 
        SECRET_KEY_BASE: token 
        DEVISE_SECRET_KEY: token 
      env_file:
        - ~/production.env
      restart: always`
  </code></pre>
  
  <p>And in config/sidekiq.yml</p>
  
  <pre><code>:verbose: true
  :concurrency: 1
  :pidfile: ./tmp/pids/sidekiq.pid
  staging:
    :concurrency: 10
  production:
    :concurrency: 20
  :queues:
    - default
    - mailers
  </code></pre>
  
  <p>I am stuck, I had thought that this was a problem of volumes, since I have another file for 'local production test images' and binded volumes: - .:/my_app inside sidekiq and web services, so in production I deleted this lines as mention <a href="https://docs.docker.com/compose/production/#modify-your-compose-file-for-production" rel="nofollow noreferrer">Docker Compose in Production</a> but I get error <code>production_sidekiq | No such file or directory @ rb_sysopen - /my_app/tmp/pids/sidekiq.pid</code></p>
  
  <p>Puma server on web service runs ok.</p>
  
  <p>Any idea what is going on?</p>