11# docker-cardano-node
2+
23Builds a Cardano full node from source on Debian. This image attempts to keep
34interface compatibility with ` inputoutput/cardano-node ` , but may diverge
45slightly, particularly with any Nix-specific paths.
56
67## Running a node
8+
79To run a Cardano full node on mainnet:
10+
811``` bash
912docker run --detach \
1013 --name cardano-node \
@@ -13,27 +16,56 @@ docker run --detach \
1316 -p 3001:3001 \
1417 ghcr.io/cloudstruct/cardano-node run
1518```
19+
1620The above maps port 3001 on the host to 3001 on the container, suitable
1721for use as a mainnet relay node.
1822
1923Node logs can be followed:
24+
2025``` bash
2126docker logs -f cardano-node
2227```
28+
29+ Running a node on a different network uses a slightly different syntax.
30+
31+ To run a Cardano full node on preview:
32+
33+ ``` bash
34+ docker run --detach \
35+ --name cardano-node \
36+ -v node-data:/data/db \
37+ -v node-ipc:/ipc \
38+ -e NETWORK=preview \
39+ -p 3001:3001 \
40+ ghcr.io/cloudstruct/cardano-node
41+ ```
42+
2343## Running the CLI
44+
2445To run a Cardano CLI command, we use the ` node-ipc ` volume from our node.
46+
2547``` bash
2648docker run --rm -ti \
2749 -v node-ipc:/opt/cardano/ipc \
2850 ghcr.io/cloudstruct/cardano-node cli < command>
2951```
52+
3053This can be added to a shell alias:
54+
3155``` bash
3256alias cardano-cli=" docker run --rm -ti \
3357 -v node-ipc:/opt/cardano/ipc \
3458 ghcr.io/cloudstruct/cardano-node cli"
3559```
60+
3661Now, you can use cardano-cli commands as you would, normally.
62+
3763``` bash
3864cardano-cli query tip --mainnet
3965```
66+
67+ Or, for preview:
68+
69+ ``` bash
70+ cardano-cli query tip --network-magic 2
71+ ```
0 commit comments