JasonJoel Posted June 22, 2019 Share Posted June 22, 2019 (edited) What I am trying to do is run a simple node.js app in a container, instead of the Ubuntu VM it is in now. I am a docker novice, but have been using it for a few years - mostly pre-made containers, but on Ubuntu I've made a few of my own that work as expected. I've never used a custom container in unraid, though, and the differences are tripping me up. In the end, what I'm trying to do is exactly what is described on the official node.js docker page: Quote Run a single Node.js script For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a Node.js script by using the Node.js Docker image directly: $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node:8 node your-daemon-or-script.js Is there a relatively straight forward way to do this in Unraid? I see how I can import the node container from docker hub, but past that I'm struggling. Thanks in advance for any help or advice. Edited June 22, 2019 by JasonJoel Quote Link to comment
Squid Posted June 22, 2019 Share Posted June 22, 2019 37 minutes ago, JasonJoel said: and the differences are tripping me up. Just an FYI, but there are zero differences. A container is a container is a container. Thats the whole point of them. Self-contained applications that can be run on any platform without modifications Quote Link to comment
JasonJoel Posted June 22, 2019 Author Share Posted June 22, 2019 Fair enough - poor wording choice on my part. How to do the container definition via the GUI was tripping me up. I did get it to work, though, so thought I would come back and at least list how I did it (even though it was simple for anyone that understands docker better than I do ): 1. Imported node container from docker hub via CA 2. Set network to the interface I needed (br3 in my case) 3. Set static IP address 4. Added a path setting for the /user/src/app container location to /mnt/usr/appdata/<container name> 5. Switched to Advanced View 6. Added "-w /usr/src/app" in "Extra Parameters:" 7. Added "server.js" in "Post Arguments:", with server.js being the name of my node.js app. 8. Hit Apply and ran the container. 2 Quote Link to comment
Squid Posted June 22, 2019 Share Posted June 22, 2019 Probably your best bet is to get it working first via the command line, and then back ported it to the GUI template Quote Link to comment
brbeaird Posted September 4, 2019 Share Posted September 4, 2019 On 6/22/2019 at 9:45 AM, JasonJoel said: 6. Added "-w /usr/src/app" in "Extra Parameters:" 7. Added "server.js" in "Post Arguments:", with server.js being the name of my node.js app. Thank you for posting these steps. I had the worst time figuring this out for whatever reason. How did you figure out the extra parameter and post argument steps? 1 Quote Link to comment
Abigel Posted September 17, 2022 Share Posted September 17, 2022 Is there in meantime a solution? I mean a docker app for node.js for hosting a js app? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.