I have created through a Dockerfile a Docker image on which Ubuntu 18.04 and ROS Melodic are properly installed. Please note that I have not used the official ROS-Docker image for creating my Docker image.
The Docker container derived from this Docker image is working fine. However, every time I want to work with the container, I need to execute the following commands:
- Terminal window:
docker run -d -it --name container_name docker_image; docker exec -it container_name bash
Then, after I am within the Docker container:
roscore
- Terminal window:
docker exec -it container_name bash
Then, after I am within the Docker container:
rosrun ROS_PackageName PythonScript.py
Please note that through the above-mentioned Docker commands, both terminals operate in the same Docker container.
I find my way to start the PythonScript.py inefficient. Therefore, I would like to ask for the best practice to start "roscore" followed by "rosrun ...." on Docker Container startup.
In some Dockerfiles I see at the end of the file the command ENTRYPOINT as well as CMD.
However, I do not know if these commands can help me to make my Docker container execute "roscore" followed by "rosrun" on container startup.