Estoy tratando de ejecutar un servidor de rieles en una imagen acoplable junto con una imagen de interfaz mysql y vue. Estoy usando Ruby 3 y Rails 6. La imagen mysql y frontend se inician sin problemas. Sin embargo, las imágenes de los rieles no se inician. Estoy en una Macbook Pro con MacOS Monterey y Docker Desktop 4.5.0
este es mi docker-compose.yml:
version: "3" services: mysql: image: mysql:8.0.21 command: - --default-authentication-plugin=mysql_native_password environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=nauza_backend_development ports: - "3307:3306" volumes: - mysql:/var/lib/mysql backend: build: context: nauza-backend args: UID: ${UID:-1001} tty: true stdin_open: true command: bundle exec rails s -p 8080 -b '0.0.0.0' volumes: - ./nauza-backend:/usr/src/app # attach a volume at /bundle to cache gems - bundle:/bundle # attach a volume at ./node_modules to cache node modules - node-modules:/usr/src/app/node_modules # attach a volume at ./tmp to cache asset compilation files - tmp:/usr/src/app/tmp environment: - RAILS_ENV=development ports: - "8080:8080" depends_on: - mysql user: rails environment: - RAILS_ENV=development - MYSQL_HOST=mysql - MYSQL_USER=root - MYSQL_PASSWORD=root frontend: build: context: nauza-frontend args: UID: ${UID:-1001} volumes: - ./nauza-frontend:/usr/src/app ports: - "3000:3000" user: frontend volumes: bundle: driver: local mysql: driver: local tmp: driver: local node-modules: driver: localy este es mi Dockerfile:
FROM ruby:3.0.2 ARG UID RUN adduser rails --uid $UID --disabled-password --gecos "" ENV APP /usr/src/app RUN mkdir $APP WORKDIR $APP ENV EDITOR=vim RUN apt-get update \ && apt-get install -y \ nmap \ vim COPY Gemfile* $APP/ RUN bundle install -j3 --path vendor/bundle COPY . $APP/ CMD ["rails", "server", "-p", "8080", "-b", "0.0.0.0"]cuando intento iniciar esto con docker-compose up en mi Mac, aparece el siguiente error:
/usr/local/lib/ruby/3.0.0/fileutils.rb:253:in `mkdir': Permission denied @ dir_s_mkdir - /usr/src/app/tmp/cache (Errno::EACCES)¿Alguna idea sobre cómo solucionar este problema?
Elimine la línea - tmp:/usr/src/app/tmp en su Dockerfile.
Yo diría que no necesita acceder a los archivos temporales de su contenedor. 🙂