I am not sure why I expected this to work:
# Dockerfile
FROM node:6
FROM java:8
but it doesn't really work - looks like the first command is ignored, and second command works.
Is there a straightforward way to install both Node.js and Java in a Docker container?
Ultimately the problem I am trying to solve is that I am getting an ENOENT error when running Selenium Webdriver -
[20:38:50] W/start - Selenium Standalone server encountered an error: Error: spawn java ENOENT
And right now I assume it's because Java is not installed in the container.
The
FROM
inside your dockerfile simply tells docker from which image it should start the configuration. You can't simply concatenate multiple images together. There are already multiple container images available which offer preinstalled Java 8 and node JS. I don't want to recommend any image specifically but will direct you to docker-hub for you to go search on your own and use the container that suites your needs the best.The best way for you is to take java (which is officially deprecated and it suggests you use
openjdk
image) and install node in it.So, start with
This will use the latest openjdk image, which is
8u151
at this time. Then installnode
and other dependencies you might need:You might want to install things like grunt afterwards, so this might come in handy as well.
In total you will get the following Dockerfile:
You may clone the Dockerfile from my gitlab repo here
You can use single
FROM
per generated image. Try to usenode
as a base image and install java to it.