Repository navigation
3. Usage
Enter corresponding directory and run following command to build docker image:
docker build -t <image_name>:<tag_name> <dockerfile_path>
For concrete example (ros-kinetic with gazebo) run following:
docker build -t ros_gazebo_img:melodic_11 .
In order to create container from Dockerfile run following commmand:
docker run -it --network host --privileged -v /dev:/dev --name <container_name> <img_name>:<tag_name>
Run docker container with GUI support
docker run -it --network host --gpus all --privileged -e DISPLAY=$DISPLAY -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix \
--name <container_name> <img_name>:<tag_name>
Also, before using param --gpus make sure you've installed nvidia-container-toolkit as mentioned before.
Make sure you have latest drivers for your GPU.
docker start -i <container_name>
docker exec -it <container_name> bash
Kill container:
docker kill <container_name>
Stop container:
docker stop <container_name>
Remove container:
docker rm <container_name>
Attach existing detached cotainer:
docker attach <container_name>
Clean dangling images and stopped containers (bear in mind that this deletes every container that's not currently running, not recommended):
docker system prune
There's example of using build-args for installing IDE in container in following Dockerfile
docker build --build-arg <arg_name>=<arg_value> -t <image_name>:<image_tag> .
You can commit current state of docker image as follows:
docker commit --author filip.zoric@fer.hr --pause --message "[fer-auth] integration" mmuav_audio_cont auth_fer_uav_img:latest
Such image you can then compress to tar.gz or push to docker registry.
You can save docker image with docker save command and compress it to gzip as follows:
docker save <img_name>:<tag> | gzip > <archive_name>.tar.gz