Useful Commands in GrandNode management in Docker
If you are reading this article, probably you've decided to install GrandNode with Docker. It's great choice, trust me! If you are an administrator, the docker management won't be difficult for you, but if you are a beginner user, it can be tricky.
I will try to point some useful tips which will help you understand the GrandNode in Docker.
Let's start with the basics.
Docker pull
It's a basic command to pull the newest GrandNode image from our GitHub. Just use the:
docker pull grandnode/develop
where grandnode/develop is the name of repository/branch.
Docker run
This command is responsible for Docker creation from specified image.
docker run -d -p 127.0.0.1:8080:80 --name grandnode -v app-data:/app/App_Data grandnode/develop
Let's explain that command, because it may look tricky.
-d - Run container in background and print container ID
-p - Publish a container's port(s) to the host
--name - Name of your container
-v - Mount volume. If you mount the App_Data directory, you will be able to enter to it via FTP client, like FileZilla.
grandnode/develop - It's the newest docker image from our GitHub - repository grandnode, branch develop
Docker start/stop/restart
docker start grandnode
docker stop grandnode
docker restart grandnode
It's used to start container, stop it or restart. What's neccessary when you will editing or adding files in your container.
grandnode is the name of my container
Docker cp
It's command used to copy files from host to local and from local to host.
It can looks like:
docker cp grandnode:/app/appsettings.json .
docker cp appsettings.json grandnode:/app/appsettings.json
appsettings.json is the file which I want to copy from my container to local directory, then from local directory to my grandnode container.
. in the first command is the "local directory", mostly it's root directory.
grandnode:/app/appsettings.json - grandnode is the name of my container, /app/appsettings.json is the path to file which I want to copy.
Docker link
It's used to link one docker container with another. In our case we can link MongoDB during GrandNode installation, to link it to our app.
You can do it with the following command:
docker run -d -p 80:80 --name grandnode --link mongodb:mongo grandnode/release_4.10
Where mongodb is the name of our MongoDB container and mongo is the name of the mongodb official image.
Leave your comment