6.6 Best Practices

This section includes some tips and best practices for deploying Docker containers:

  • NetIQ recommends you to set a limit on the amount of CPU used for a container. This can be achieved by using the --cpuset-cpus flag in the docker run command.

  • To set a restart policy for a container, use the --restart flag in the docker run command. It is recommended to choose the on-failure restart policy and limit the restart attempts to 5.

  • To set a limit on the memory used by a container, use the --memory flag in the docker run command.

  • To gracefully stop a container, use the --stop-timeout flag. NetIQ recommends you to set the value of this flag to 100. If there are any active processes running inside container, the container waits for 100 seconds and then exits. If all the processes are killed before the time specified in the --stop-timeout flag, the container exits when the last process is killed.