Code Monkey home page Code Monkey logo

mm-docker's Introduction

mm-docker

Note: Always refer to the README in the master branch from the most up-to-date information.

Originally forked from here, this fork is specifically designed for running UTIAS mobile manipulator code.

Run Ubuntu 14.04 with ROS Indigo with a shared username, home directory, and X11 graphics on a computer with a different Ubuntu version. Requires Docker:

sudo apt install docker-ce

Note that any changes made outside of your home directory from within the Docker environment will not persist. If you want to add additional binary packages without having to reinstall them each time, add them to the Dockerfile and rebuild.

NVIDIA

If your laptop has an NVIDIA graphics card, you'll need to use the nvidia branch. That branch includes NVIDIA support by leveraging this Dockerfile.

This used to require installing a separate package nvidia-docker2, but Docker now supports NVIDIA natively since version 19.03. However, you still need to install the nvidia-container-runtime:

  1. Add the repository by following these instructions.
  2. Install: sudo apt install nvidia-container-runtime.
  3. Add the runtime to docker: sudo dockerd --add-runtime=nvidia=/usr/bin/nvidia-container-runtime

macOS

It is not immediately obvious how to get this working on a Mac. There are definitely some differences from Linux, and this post may provide a reasonable starting point.

Usage

  1. The name of your image must be in a file called image_name.txt.
  2. Run build-image.sh to build your image, based on the provided Dockerfile. This only needs to be done once unless you make changes to the Dockerfile.
  3. Run new-container.sh to create a container from your built image. This only needs to be done once unless you wish to reset the environment of the container. This script will also automatically enter the newly created container.
  4. If an existing container has been stopped (e.g., if you restarted your computer), run restart-container.sh to restart it. This does not automatically enter the newly created container; to do this, run attach-to-container.sh. You can also run attach-to-container.sh from any new terminal sessions to attach to the same running container.

Sourcing ROS

You may now be using multiple ROS versions on the same computer: Indigo with this Docker image and another for your actual Ubuntu version. You can add something like the following to your .bashrc to choose the right one:

# for example, with ROS kinetic on my base system
if [ -d /opt/ros/kinetic ]; then
  source /opt/ros/kinetic/setup.zsh
elif [ -d /opt/ros/indigo ]; then
  source /opt/ros/indigo/setup.zsh
fi

Useful Docker Commands

  • docker ps: List running containers. If you see your container running here, you can attach to it.
  • docker ps -a: List all containers (running and stopped).
  • docker images: List docker images.

Modified Shell Prompt

It can be hard to tell if your terminal is currently in a docker container. One convenient way to do this is to change your prompt. The following code prepends (D) to your shell prompt, and should work for both bash and zsh.

Add the following to the end of your .bashrc (or .zshrc if using zsh), or anywhere after the $PS1 variable is created:

if [ -f /.dockerenv ]; then
  PS1="(D)$PS1"
fi

mm-docker's People

Contributors

adamheins avatar

Watchers

 avatar  avatar

Forkers

trevorablett

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.