Can we run multi-process program in docker?

I have some code using multi-process like this:

import multiprocessing
from multiprocessing import Pool

pool = Pool(processes=100)
result = []

for job in job_list:        
    result.append( 
        pool.apply_async(
            handle_job, (job)
            )
        )
pool.close()
pool.join()

This program is doing heavy calculation on very big data set. So we need multi-process to handle the job concurrently to improve performance.

  • How to give my desktop Ubuntu machine's user full permissions to a docker volume, in addition to TWO users within the docker container?
  • Is it possible to have docker running inside of vmware?
  • How are people authenticated in their ASP.NET Core Web APIs on Ubuntu/Docker given the bug described below?
  • mysql_config_editor with docker
  • Unable to access docker SimpleHTTPServer container
  • Docker compose with networks and “internal” property example
  • I have been told that to the hosting system, one docker container is just one process. So I am wondering how my multi-process will be handled in Docker?

    Below are my concern:

    1. Since the container is just one process, will my multi-process code become multi-threading in the process?

    2. Will the performance become down? Because the reason I use multi-process is to get job done concurrently to get better performance.

  • How to access to docker config file in S3 bucket from Elastic Beanstalk instance
  • High Availability for Bluemix Secure Gateway Docker Client
  • Update (pull) all docker images at once
  • Where my files exist in Docker image?
  • Docker compose hangs when installing kerberos
  • How to get all Travis CI environment variables, excluding the default system ones?
  • 2 Solutions collect form web for “Can we run multi-process program in docker?”

    Docker includes namespaced process id’s and full support for running multiple processes by the kernel. Inside of a container, you can run ps to see the isolated process list (which will often just be your shell and the ps command).

    The description of docker for running a single application is to separate the application isolation technology from the more familiar OS virtualization tools out there where you’d launch the web server, mail server, ssh daemon, etc in the background.

    A few words of caution:

    • Once pid 1 exits, your container ends, regardless of whether your forked processes are still running or not.
    • Without init, exited processes that are not reaped by their parent will remain as zombies (they will not pass the namespace isolation to reach the host init process). There’s a tini application you can run as your entrypoint to clean up these if this is an issue (tini github repo).
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.