-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor run-nodered script #816
Changes from 4 commits
c6e6508
d3a67c0
439cfa1
d18da86
796e0e1
ed71995
d7ddd8d
14ca168
3de153e
e82d5ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
cd @EVEREST_DOCKER_DIR@ | ||
docker build -t everest-nodered . | ||
docker run --rm --network host --name everest_nodered --mount type=bind,source=@FLOW_FILE@,target=/data/flows.json everest-nodered | ||
# In the following a volume is created to contain the nodered config, this is done to | ||
# allow starting the nodered container from inside a devcontainer | ||
|
||
# Create docker volume to contain nodered config | ||
docker volume create nodered-config-volume | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is more or less the way how the script worked before, I changed it to be able to start this container from inside a devcontainer, see below. I changed the name of the volume and temporarily container to have a prefix |
||
# Create temporarily container to copy nodered config into the created volume | ||
docker create -v nodered-config-volume:/data --name nodered-config-container debian:12-slim true | ||
|
||
# Copy nodered config to the created volume with the temporarily created container | ||
docker cp @FLOW_FILE@ nodered-config-container:/data/flows.json | ||
|
||
a-w50 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Remove temporarily container | ||
docker rm nodered-config-container | ||
|
||
# Start nodered container with the volume mounted to /data | ||
docker run --rm --network host --name everest_nodered --mount type=volume,source=nodered-config-volume,target=/data ghcr.io/everest/everest-dev-environment/nodered:v0.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does using a volume allow to start the node-red container from inside a dev container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace inside the devcontainer is mounted to an other path. So you would need to know about the host path of the flow file.
docker run
is executed on host with host pathsdocker cp
is executed with container's pathsThis way it is possible to copy a file with only knowing the devcontainer paths into a docker volume which then can be mounted by name into the nodered container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, well this is really ugly. These docker inside docker scenarios are quite special, not sure whether we should support these - they might break quite easily. This script here basically only works, if the devcontainer has been launched correctly - which is an assumption I wouldn't necessarily make.
Does this script work, when executed from the host (i.e. outside of the container?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not real docker inside docker, because it is more like remote controlling the hosts docker socket.
This script is designed to work inside and outside the devcontainer. Of course it needs to be rebuild when changed because of paths