Stop and Restart a Docker Container
This page describes how to stop and start your Hub server. To prevent unexpected loss of data, you need to stop your Hub server before performing any of the following updates:
Changing the location of the Hub database or other application files.
Modifying Hub properties or JVM options for your Hub server.
Switching traffic from HTTP to HTTPS and vice versa.
Upgrading your Hub installation.
Stop a Docker Container
To stop the Hub service gracefully, run the command:
For a graceful shutdown, you can also use the standard docker kill
command:
We do not recommend using the standard command docker stop
. By default, this command sends the SIGTERM
signal to the Hub process inside the Docker container, then waits for 10 seconds. If Hub does not shut down completely within that time period, the SIGKILL
is sent to the kernel, immediately terminating the Hub process. This may lead to data corruption. To avoid this outcome, specify an appropriate timeout value when using this command. For example, the following command leaves enough time for the Hub service to shut down:
Start Hub with a Docker Container
To run the Hub container, enter the following command:
Command attributes:
-it
a command-line flag that attaches both the input and output of the container to your terminal. This lets you see the output produced by the container as if it were running directly in your terminal.When the container starts, you will see the log messages generated during the initialization process as well.
Pressing Ctrl+ C while the terminal is attached to a container's output sends an interrupt signal to the container's running process. This is similar to how you would stop a regular process in your terminal. This command causes the container to shut down, so be cautious when using Ctrl+ C in this context.
If you want to detach the terminal from the container output without interrupting the processes running in it, press Ctrl+ P followed by Ctrl+ Q.
For more details, please refer to the the official docker documentation.
--name hub-server-instance
this is an arbitrary name for the container.By default, Docker generates random and sometimes cryptic names for containers. Use the
--name
option to give your container a more meaningful and human-readable name that makes it easier to identify and manage.-v <path to <name> directory>:/opt/hub/<name>
these options specify the location of the storage provisioned on the host machine and maps them to the corresponding/opt/hub/<name>
directories inside the container.-p <port on host>:8080
parameter that defines the port mapping. This tells the host machine to listen for traffic on the<port on host>
port and propagate all traffic to port8080
inside the container.