Install yarn in a docker container says missing dependency

I’m using the node:6.7.0 image as my docker container and then follow the installation guide for yarn

sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Then I do

  • Docker - image operating system “windows” cannot be used on this platform
  • Manage multiple nginx containers on the same host with Docker Swarm
  • Mean Stack Application Deployment Using Docker Failed
  • Homebrew: Linking custom taps to existing bottles in bintray
  • Why patch linux kernel on Centos for using Docker.io
  • AWS Elastic Beanstalk is ignoring my Dockerrun.aws.json file
  • apt-get update && apt-get install yarn
    

    But at this point I get an error message which says

    yarn : Depends: nodejs (>= 4.0.0) but it is not going to be installed
    

    I’ve echoed node -v before the install and it also says 6.7.0

    Anything that I’m missing?

  • Kubernetes behind explicit proxy
  • Confused about docker pricing policy [closed]
  • Docker initiate the connection to archive.ubuntu
  • How do I filter docker swarm nodes by label?
  • Docker compose error with docker-engine version
  • Kubernetes UI: error in kubectl proxy
  • One Solution collect form web for “Install yarn in a docker container says missing dependency”

    robertklep is right – if you check the Dockerfile for Node you’ll see they install Node by downloading the TAR, not through APT. You can check this by running an interactive container:

    > docker run -it node:6.7.0 bash
    root@465fa07437c9:/# dpkg -s nodejs
    dpkg-query: package 'nodejs' is not installed and no information is available
    

    You can use NPM in your Dockerfile instead:

    FROM node:6.7.0
    RUN npm install -g yarn
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.