How to add a service witch runs on docker
Hi,
I have a dockerfile witch builds a docker image that runs a node service on port 8081. I would like to build and start this docker service when I start eclipse che.
How could I do this? I already tried to add my dockerfile inside of the dockerfiles directory expecting that my docker images was built, but is not working.
Thanks.
@mstavares you can either build an image, push it to a registry and create a custom stack in Che, or create a custom stack from a Dockerfile
https://www.eclipse.org/che/docs/creating-starting-workspaces.html
Hi @eivantsov, thanks for your reply.
Your solutions seems fit very well. Is it possible to get the docker IP that I'm launching in my workspace? I would be very happy if it was possible to set a static ip address for that docker image.
@mstavares not sure I understood your question? Are you asking me to find out your host machine IP? :)
@eivantsov for instance:
"frontend": {
"installers": [
"org.eclipse.che.exec", "org.eclipse.che.terminal"
],
"servers": {
"8081/tcp": {
"port": "8081",
"protocol": "http"
}
},
"attributes" : {}
}
Is it possible to define a static IPv4 address for this machine in the stack? This machine "frontend" runs a docker when I instantiate a workspace through this stack. I would like to know the IP address of this docker container.
@mstavares no it is not possible
@eivantsov is not possible to define it in the stack, but is it possible to define it somewhere else?
Container gets some IP from Docker subnet. Che cannot set or predict it.
Hi @eivantsov
Is it possible to set a static port?
Key PORT PROTOCOL RUNTIME 8081/tcp 8081 http URL: http://172.17.0.1:32962
For instance, I would like to set this port 32962 to this one 8081 even when I reboot my workspace.
@mstavares no, Docker published exposed ports randomly from the ephemeral port range.
You may try single port policy though -e SINGLE_PORT=true. This way you will get a predictable URL that will not change across workspace restarts.