5

Can anyone help me with something, I'm trying to run a web server over the cardano-node docker image.

I have some solutions in mind but I would like to have some feedback from you.

Approach # 1

Build a new image over the cardano-node docker image that install node and runs my server code.

My questions around this are:

  • Where can I find the cardano-node Dockerfile? I need to know what is already setup and what is the underlaying Linux distro.
  • Related to the previous one, how can I install Node over the cardano-node image? I have tried multiple mechanisms like apt-get and nothing works.

Approach # 2

Create my webserver in a different docker image and make the container communicate with the cardano-node container.

Questions:

  • How can I communicate my web server container with the cardano-node container so I can run the cardano-cli commands?

2 Answers 2

3

Approach 1 is the only one that makes sense to me in my limited knowledge of Containers. Containers, I understand, are different operating system context, not just different process so there isn't really IPC outside of the Docker api. The TCP/IP stack really shines here. Have a small web service with your Cardano-node / Cardano-cli which does basic things with the software and have an additional webserver act as the application level service, in my opinion.

2
  • Yeah, that's something that I've thought about. However, the way the official Docker image was built makes it hard to extend. I have been thinking of creating my own following the Linux setup steps from the docs. The other part of your answer is that the docker-node image exposes the IPC through a volume, so that makes me think that it is possible to achieve such inter container communication; I don't know-how. This is my docker-compose.yml Commented Sep 27, 2021 at 20:16
  • 1
    yml version: '3.1' services: cardano-node: image: inputoutput/cardano-node environment: - NETWORK=testnet - CARDANO_NODE_SOCKET_PATH=/ipc/node.socket volumes: - data:/data - node-ipc:/ipc - ./dist/apps/cardano-server/outputs:/outputs volumes: data: node-ipc: Commented Sep 27, 2021 at 20:16
1

NIX is used to build the image. There is no Dockerfile (as far as I know). https://github.com/input-output-hk/cardano-node/blob/master/nix/docker/default.nix


You can establish cross-container communication via node.socket:

docker run -e NETWORK=mainnet -v node-ipc:/ipc inputoutput/cardano-node
docker run -e NETWORK=mainnet -v node-ipc:/ipc inputoutput/some-node-client

https://hub.docker.com/r/inputoutput/cardano-node

1
  • Thanks, I might try that later. For now, I'm building upon a community image for the Cardano Node. Commented Oct 2, 2021 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.