How Can We Help?
Search for answers or browse our knowledge base.
How to manage a Docker node
Manage node
With Docker
This is only a short summary from the fantastic docs.docker.com documentation website. Please visit it for more indepth information.
Visualization
docker-compose
bundles many services that are started together and interact together. In our case we have the services: GNY Blockchain Node (a node.js
app) and a database (postgres
) service. Each of this services is a separate docker container
.
This two services are based off their respective docker images postgres:9.6.12
and gny/blockchain
.
Docker Images
A docker image
is like a cookie cutter which can cut cookies (instantiate containers). From one image we can create exactly the same program, without the need to install or provide all libraries a program depends upon.
From an image we can create multiple containers.
![]() |
![]() |
Docker networks
docker-compose
creates automatically a network where only the services inside the docker-compose
file can communicate. This is represented by the grey box. We can configure which service ports from the containers are visible on the host machine. The postgres
database port is not reachable from the host machine. Only the GNY Blockchain service can access the postgres
database service. The GNY Blockchain ports (4096
and 4097
) are mapped to the host machine.
This is the beauty of docker-compose
. We can specify all services that should work together and with one command we can start|stop|pause all services.
Docker-Compose Lifecycle
Docker-Compose 101
Create and Start all services
sudo docker-compose --file docker-compose.yml up
This command will print all container messages to screen:
Create and Start all services
sudo docker-compose --file docker-compose.yml up --detach
This command runs all services in background. See logs
command to see the logs of the services in the background.
Start all services
This can only be executed if the docker-compose network
and all containers
were created previously. For example after an docker-compose stop
.
sudo docker-compose --file docker-compose.yml start
Check status of services
sudo docker-compose --file docker-compose.yml ps
Stop all services
sudo docker-compose --file docker-compose.yml stop
Stop and Remove
This removes the docker-compose network
and volumes
that were created.
sudo docker-compose --file docker-compose.yml down --volumes
Docker 101
Images
Show all images
sudo docker image ls
Get bash into image
sudo docker run -it <imageId> /bin/bash
Containers
Show status of running containers
sudo docker ps --all
Show status of containers of a docker-compose file
sudo docker-compose --file docker-compose.yml ps
Bash into running container
sudo docker exec -it <containerId> /bin/bash
Delete
Stop all running containers
sudo docker stop $(sudo docker ps --all --quiet)
Delete all stopped containers
sudo docker rm $(sudo docker ps --all --quiet)