Install yarn in docker image


When deploying a Rails application (v5.2.4) created using Docker to a production environment, when I tried to precompile the assets, I got the following error and could not execute it.

$docker-compose run web bundle exec rake assets:precompile RAILS_ENV=production
Starting excite-map_db_1 ... done
Yarn executable was not detected in the system.
Download Yarn at

How to solve

Add the following to the Dockerfile

RUN curl | bash
RUN curl | apt-key add -
RUN echo "deb stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update && apt-get install -y nodejs yarn postgresql-client


Recommended Posts

Install yarn in docker image
Build Spring Boot + Docker image in Gradle
[Docker] Start container, start bash in container, delete image
How to install Docker
Dramatically speed up slow bundle install in docker environment
Install the plugin in Eclipse
Install docker and docker-compose on ubuntu in the shortest process
Install docker, docker-compose for debin10
Install tomcat plugin in eclipse
JavaFX-Load Image in the background
Install a CA certificate in ColdFusion
Include image resources in jar file
2. Create Docker image and register Registry
[Splunk] Build Splunk Enterprise (use docker image)
How to install Swiper in Rails
Install Zabbix 5.0 with Docker → Set up Slack notification in case of failure