Can I run docker run with mpiexec to execute mpi c program?

I would like to run docker with optional flags such as -it, --memory, --cpu … to execute an mpi program in c with mpiexec. is this possible?

Thanks

What’s the actual problem? I don’t know what mpiexdc or mpi c program is. Why do you have problem with the options?

Let’s make it simple. Can I run a bash script whithin a docker run command? For example:

docker run --cpu … mpiexec ./bash_script

?

It depends on the entrypoint script set up (in Dockerfile). Sometimes you can pass shell commands, sometimes it’s just additional CLI arguments for the pre-set command.

You can overwrite entrypoint with docker run --entrypoint.

As @bluepuma77 wrote. But if you tried and had an error message which you can share, we can try to explain it.

Of course if mpiexec is a command and not the name of the image, you need that command and shell script to be inside the container as well.

How come when I do:

$ sudo docker run busy_ritchiegolang

Then do:

$sudo docker ps

There is an empty list?

Doing:

$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8680f0ed0b6e golang “bash” 17 seconds ago Exited (0) 16 seconds ago busy_ritchie
ab115bfc466a golang “bash” 2 minutes ago Exited (0) 2 minutes ago nervous_dijkstra
cdc002595d38 golang “bash” 7 minutes ago Exited (0) 7 minutes ago eager_yalow

I see that the containers were create.

I did do:B

$ sudo systemctl restart docker.socket

and

$ sudo systemctl restart docker

But this didn’t work.


Please, format your posts according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

Because based on your outputs, you run a bash only, nothing that keeps the container alive. If you don’t keep a container alive with a running process, it will stop as it is not a virtual machine and shell will not stay alive unless you ask for an interactive terminal. If you don’t share a specific issue with commands, config files or anything that is required to reproduce the issue, it is hard to say anything useful, but I can share some links I usually recommend to learn the basics.

Recommended links to learn the basics and concepts:

The last link is (currently) about Docker Desktop which is Docker CE in a virtual machine whith a GUI.

Thanks, I will look at this.