Commit bfa239e0 authored by Hebant Martin's avatar Hebant Martin
Browse files

First commit

# ROS Docker container
Docker container to develop and run ROS applications
Features :
- Ubuntu xenial based
- ROS kinetic (ros-kinetic-desktop)
- X11 enabled
- Provide a ros user which have the same uid and gid as the host user
Requiere X11, xhost, docker and docker-compose
## Run the container
Run `./` in terminal. This will run the container and start the ros master (roscore).
## Open a new shell in the container
Run `./` in a terminal. This will login as the ros user and open bash shell.
## Install new packages on the container
Add installation command at the end of the `./ros/Dokerfile` (apt command, etc...).
Then rebuild the container by running `sudo docker-compose build`.
## Change .bashrc of the ros user
The .bashrc for the ros user is available at `./ros/.bashrc` and can be modified.
## Add volumes to the container
Add new volumes in the end of `./docker-compose.yml`.
CURRENT_UID=$(id -u):$(id -g)
sudo docker-compose exec -u $CURRENT_UID ros bash
build: ros
- /tmp/.X11-unix:/tmp/.X11-unix
- ./ros/bashrc:/home/ros/.bashrc
# Add your volumes here
\ No newline at end of file
sudo systemctl start docker
xhost +local:docker # allow docker to access x11
HOST_UID=$(id -u)
HOST_GID=$(id -g)
sudo HOST_UID=$HOST_UID HOST_GID=$HOST_GID docker-compose up
xhost -local:docker # remove access to x11
FROM ros:kinetic-ros-core-xenial
# Install ros-kinetic-desktop
RUN apt-get update && apt-get install -y \
COPY ./ /
CMD ["roscore"]
# Install yours packages here
#ex: RUN apt-get install python-pip
source "/opt/ros/$ROS_DISTRO/setup.bash"
set -e
# create ros group and ros user matching uid and gid of the host user
id -u ros &> /dev/null || ( # if user ros does not exist
groupadd -g $HOST_GID ros
useradd -m -u $HOST_UID -g $HOST_GID ros
adduser ros sudo
) &> /dev/null
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
exec "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment