I can start a standalone container with this command:
sudo docker run --rm -it -p "8000:8000" -v "/home/maxou/stellar:/opt/stellar" --name stellar stellar/quickstart --standalone
I can call rest commands on horizon, and when I log into the container, I see all the processes running, supervisord shows:
root@aba039d92900:/# supervisorctl
horizon RUNNING pid 154, uptime 0:08:08
postgresql RUNNING pid 152, uptime 0:08:08
stellar-core RUNNING pid 153, uptime 0:08:08
I then terminate the interactive container (CTRL+C)
and launch the container in background mode:
sudo docker run -d -p "8000:8000" -v "/home/maxou/stellar:/opt/stellar" --name stellar stellar/quickstart --standalone
a2d8d906f7aa52644e215f336e1099441b37090b773fe6745794afc4e0f31d6c
Then when I try to log into it, I get a "container not running" error:
sudo docker exec -it stellar /bin/bash
Error response from daemon: Container a2d8d906f7aa52644e215f336e1099441b37090b773fe6745794afc4e0f31d6c is not running
docker ps tells me that the container exited right after starting:
sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2d8d906f7aa stellar/quickstart "/init -- /start --s…" About a minute ago Exited (0) About a minute ago stellar
What is wrong ? I would like to run the container as a service, with all the stellar services always running
Update
If I run this command as suggested by a responder:
docker run -dit -e POSTGRES_PASSWORD=stellar --restart always -v "/home/maxou/tstellar:/opt/stellar" -p "8000:8000" --name stellar stellar/quickstart --standalone
fecbf92650eafb65b82fdaefb19c35113934f36ae9b4bb41b07b4ffacbdd4acf
Things seem to function properly:
root@fecbf92650ea:/# supervisorctl
horizon RUNNING pid 158, uptime 0:00:11
postgresql RUNNING pid 156, uptime 0:00:11
stellar-core RUNNING pid 157, uptime 0:00:11
Now, if I restart the container with docker restart stellar
things get broken:
root@fecbf92650ea:/# supervisorctl
unix:///var/run/supervisor.sock refused connection
supervisor>
If I start the container with the console attached, I see this
docker start -a stellar
running `/start --standalone'
pids are [6]
Starting Stellar Quickstart
mode: persistent
network: standalone (Standalone Network ; February 2017)
postgres: config directory exists, skipping copy
supervisor: config directory exists, skipping copy
stellar-core: config directory exists, skipping copy
horizon: config directory exists, skipping copy
postgres: already initialized
core: already initialized
Waiting for postgres to be available...
postgres: up
init-core-scp: failed!
2020-02-27T20:48:20.520 <startup> [default INFO] Config from /opt/stellar/core/etc/stellar-core.cfg
2020-02-27T20:48:20.521 <startup> [default INFO] RUN_STANDALONE enabled in configuration file - node will not function properly with most networks
2020-02-27T20:48:20.521 <startup> [default INFO] Using QUORUM_SET: {
"t" : 1,
"v" : [ "self" ]
}
ERROR FROM EASYLOGGING++ (LINE: 753) <ERROR> Bad file [stellar-core.2020.02.27-20:48:20.log]
: Permission denied [13]ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [TRACE] to FALSE
ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [DEBUG] to FALSE
ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [FATAL] to FALSE
ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [ERROR] to FALSE
ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [VERBOSE] to FALSE
ERROR FROM EASYLOGGING++ (LINE: 1813) <ERROR> Setting [TO_FILE] of [INFO] to FALSE
...
...
...
2020-02-27T20:48:20.534 GCTI6 [Database INFO] Connecting to: postgresql://dbname=core host=localhost user=stellar password=********
2020-02-27T20:48:20.544 GCTI6 [SCP INFO] LocalNode::LocalNode@GCTI6 qSet: d05a3b
2020-02-27T20:48:20.544 GCTI6 [default INFO] Application destructing
2020-02-27T20:48:20.544 GCTI6 [default INFO] Application destroyed
2020-02-27T20:48:20.545 GCTI6 [default FATAL] Got an exception: Unable to create bucket directory: buckets [CommandLine.cpp:1015]
2020-02-27T20:48:20.545 GCTI6 [default FATAL] Please report this bug along with this log file if this was not expected [CommandLine.cpp:1016]
exited 6