- Remove the outdated versions of Docker from your system:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done-
I suggest you install docker using the convinence script method mentioned in the official docker installation instructions Page.
-
Verify the Installation using:
sudo docker run hello-world- Post-Installation Configuration:
sudo groupadd docker
sudo usermod -aG docker $USER
sudo reboot- To test that you can run Docker without using “sudo”, type the following command:
docker run hello-world- To enable docker to start on boot:
sudo systemctl enable docker.service
sudo systemctl enable containerd.service- If you're using a already docker configured system then check the following:
docker info -f '{{ .DockerRootDir}}'- If your docker root is not configured to the docker root directory then change it. You can follow this Page
- Clone this repo into your main project folder (The metapkg directory):
cd ~/ros2_ws/src/{yourMetaPkgDir}/
git clone -b main https://github.com/TankalaSatyaSai/DockerForRobotics.git
mv -r DockerForRobotics docker - Create your own docker image:
cd ./docker
bash image_build.sh
# This will might take sometime,depending on your system speed. - Check the image, if its created succesfully:
docker images | grep {YourImageName}
# By default I've named it robot_sim- After the image is created to run the services in docker compose:
docker-compose up - If you want to run only a specific service:
docker compose up -d robot_sim- To enter into a specific container:
docker compose exec robot_sim bash- Provide the control access to the X server, which is responsible for handling graphical displays on linux. You could do this by:
# run this in your host shell
xhost +local:root
#or
xhost +- To remove all unused Docker resources (images, containers, networks, and volumes), type:
docker system prune- If at any stage you want to remove the image you just created, type:
docker rmi manipulation:latest- To remove unused images, you would type:
docker image prune- To remove all images, you would do this:
docker image prune -a- You can also free up space on your computer using this command (I run this command regularly):
docker system prune- To inspect an image’s details:
docker image inspect manipulation:latest- To view the history of an image’s layers:
docker history manipulation:latest- To save an image as an archive:
docker save manipulation:latest > manipulation.tar- To load an image from a tar archive:
docker load < manipulation.tar