I am trying to run a local Chainlink Node with Docker on my Windows laptop. I use a "Code Along" tutorial on Youtube as foundation but also have tried other sources to get around my problem. Since I have no experience with Docker yet, I am struggling to configure the docker compose file for the chainlink node when I try to use the command "docker compose up". It is possible that my mistake is really easy to spot since I am a beginnner in this... But I fail to figure it out by myself...
Docker compose file:
services:
pg_chainlink:
image: "postgres"
ports:
- "5432:5432"
env_file:
- database.env
volumes:
- \Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli\data:\var\lib\postgressql\data\
chainlink:
image: "smartcontract/chainlink:1.3.0"
env_file:
- .env
depends_on:
- pg_chainlink
ports:
- "6688:6688"
volumes:
- \Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli\chainlink-volume:\chainlink\
command: node start --password \chainlink\password.txt --api \chainlink\apicredentials.txt
The Error :
PS C:\Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli> docker compose up
service "pg_chainlink" refers to undefined volume \Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli\data: invalid compose projectPS
C:\Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli> docker compose up
service "chainlink" refers to undefined volume \Users\Jacob\Desktop\Bachelorarbeit\Chainlink-Node\chainlink-goerli\chainlink-volume: invalid compose project
Either one of the two appears ("pg_chainlink" or "chainlink")
I suspected the slash symbols in my path to be the problem but I tried also the forward slash in many different ways. However, the usage of the double dots to map a path to the volume is also really unfamiliar and weird to me.
CodePudding user response:
This works for me on WSL2 utilizing docker on Win10.
When running locally both the postgreSQL DB chainlink container, you need to specify:
network_mode: "host"
.
version: "3.8"
services:
pg-chainlink:
container_name: pg-chainlink
image: "postgres"
restart: unless-stopped
ports:
- "5432:5432"
env_file:
- "database.env"
volumes:
- "~/data:/var/lib/postgressql/data/"
rpc-failover:
restart: unless-stopped
container_name: rpc-failover
image: "fiews/cl-eth-failover"
command: "wss://goerli.infura.io/ws/v3/<api-key>"
ports:
- "4000:4000"
link-main-node:
container_name: link-main-node
restart: unless-stopped
image: "smartcontract/chainlink:1.4.1-root"
ports:
- "6688:6688"
env_file:
- ".env"
volumes:
- "~/.chainlink:/chainlink"
command: "local n -p /chainlink/.password -a /chainlink/.api"
depends_on:
- "pg-chainlink"
- "rpc-failover"
network_mode: "host"
link-failover-node:
container_name: link-failover-node
restart: unless-stopped
image: "smartcontract/chainlink:1.4.1-root"
ports:
- "6688:6688"
env_file:
- ".env"
volumes:
- "~/.chainlink:/chainlink"
command: "local n -p /chainlink/.password -a /chainlink/.api"
depends_on:
- "pg-chainlink"
- "rpc-failover"
- "link-main-node"
network_mode: "host"