Difference between revisions of "Docker"

From Bike Wiki
Jump to navigation Jump to search
(Created page with "==SLAM== SLAM stands for Simultaneous Localization and Mapping ===What this means=== A system that builds a map of an unknown environment while simultaneously navigating the e...")
 
(Setting Up Docker Environment)
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==SLAM==
+
==Docker==
SLAM stands for Simultaneous Localization and Mapping
+
Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises.
===What this means===
 
A system that builds a map of an unknown environment while simultaneously navigating the environment using the map. It can also track the previous positions of objects in order to determine its location within the space
 
  
===What we're going to do===
+
===Why we use it===
We are in the process of making a SLAM system for the bike in order to provide the navigation team with the required data for movement.
+
We use docker as a way to have a portable, replicable environment to conduct development on the vision system without having physical access to the bike or any of its corresponding SoCs.
  
====Our Current Planned Process====
+
===Docker on Linux===
Zed ⇒ Depth img ⇒ Laserscan ⇒ Occupancy grid
+
*To install:
 +
**For Ubuntu:
 +
***<code> sudo apt-get install docker </code>
 +
**For Red Hat:
 +
***<code> sudo yum install docker </code>
 +
**For Fedora:
 +
***<code> sudo dnf install docker -y </code>
 +
**For Arch:
 +
***<code> sudo pacman -S docker </code>
  
*Zed
+
*Starting the docker daemon (on most distros):
**the camera and software that comes with it. We are using the first Zed camera.
+
**<code> sudo systemctl enable docker.service </code>
**https://www.stereolabs.com/docs/getting-started/
 
  
*Depth image
+
===Docker With Pain (Windows)===
**An image that has various distances information. Zed already can create the depth image. Because Zed has two cameras, it can calculate the distance information knowing the distance between its own two cameras.
+
Use the “edge” version or else it won’t like the windows version
  
(We may eventually get a LIDAR that will allow us to skip these steps and directly have a laser scan)
+
===Docker on Mac===
 +
Pretty straightforward installation. There is a tutorial you can follow after installation.
  
*Laserscan
+
===Setting Up Docker Environment===
**Uses the depth image to determine the shape of the objects. We plan to use the ROS package depthimage_to_laserscan to get this
+
Once docker has been installed the first thing that you need to do is create a docker image.  Docker images act as isolated, replicable instances of a software stack that can be used on any computer that has docker installed. In order to create a docker image you first need to create a Dockerfile.  A Dockerfile is a script that contains all the commands require to build an image from scratch.
**http://wiki.ros.org/depthimage_to_laserscan
 
  
*Occupancy Grid
+
*First, create and navigate to a folder to create the Dockerfile:
**The data from the laserscan is transformed into an occupancy grid, which is essentially an array of data. We are planning on using the ROS package rtabmap for this step. We could also use gmapping, but rtabmap has better documentation. For rtabmap, we plan on using the published topics grid_map.From the ROS website, grid_map creates an occupancy grid generated with laser scans. It uses parameters with prefixes map_ and grid_. We will give this to the navigation team.
+
**<code>mkdir docker</code>
**http://wiki.ros.org/rtabmap_ros
+
**<code>cd docker</code>
  
===Example SLAM projects===
+
*Next, create a Dockerfile
*SLAM Robot
+
**<code>touch Dockerfile</code>
**https://kahilyprojects.com/slam-robot/
+
 
*Turtlebot
+
*Now, edit the Dockerfile how you see fit to create the enviornment that is best for whatever purpose you need to achieve.
**https://github.com/turtlebot/turtlebot/blob/melodic/turtlebot_bringup/launch/3dsensor.launch
+
 
 +
*Once that is all done build the Dockerfile
 +
**<code>docker build</code>
 +
 
 +
*Congratulations, you have built your first docker image!
 +
 
 +
===Commands===
 +
*To run a docker image in a container/volume:
 +
**<code>docker run -it --rm --mount source=SOURCE,destination=/DESTINATION IMAGE</code>
 +
 
 +
**For example, to run an image <code>anything</code> in a container <code>autobike</code>:
 +
***<code>docker run -it --rm --mount source=autobike,destination=/autobike anything</code>
 +
 
 +
*To create a new container:
 +
**<code>docker create [OPTIONS] IMAGE [COMMAND] [ARG...]</code>
 +
 
 +
*To name a docker image:
 +
**<code>docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]</code>
 +
 
 +
*To see your docker images:
 +
**<code>docker image list</code>
 +
 
 +
*To see docker volumes:
 +
**<code>docker volume list</code>
 +
 
 +
*To delete a docker image list:
 +
**<code>docker image rm [OPTIONS] IMAGE [IMAGE...]</code>
 +
 
 +
When using a container, remember to store the code inside the folder of the container so that changes will be saved.
 +
 
 +
===Vision’s Current Used Dockerfile (as of 12/12/20)===
 +
<syntaxhighlight lang="OCaml">
 +
FROM ros:noetic
 +
 
 +
# install ros package
 +
RUN apt-get update && apt-get install -y \
 +
vim\
 +
ros-noetic-ros-tutorials\
 +
git &&\
 +
rm -rf /var/lib/apt/lists/*
 +
CMD ["/bin/bash"]
 +
</syntaxhighlight>

Latest revision as of 16:51, 22 December 2020

Docker

Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises.

Why we use it

We use docker as a way to have a portable, replicable environment to conduct development on the vision system without having physical access to the bike or any of its corresponding SoCs.

Docker on Linux

  • To install:
    • For Ubuntu:
      • sudo apt-get install docker
    • For Red Hat:
      • sudo yum install docker
    • For Fedora:
      • sudo dnf install docker -y
    • For Arch:
      • sudo pacman -S docker
  • Starting the docker daemon (on most distros):
    • sudo systemctl enable docker.service

Docker With Pain (Windows)

Use the “edge” version or else it won’t like the windows version

Docker on Mac

Pretty straightforward installation. There is a tutorial you can follow after installation.

Setting Up Docker Environment

Once docker has been installed the first thing that you need to do is create a docker image. Docker images act as isolated, replicable instances of a software stack that can be used on any computer that has docker installed. In order to create a docker image you first need to create a Dockerfile. A Dockerfile is a script that contains all the commands require to build an image from scratch.

  • First, create and navigate to a folder to create the Dockerfile:
    • mkdir docker
    • cd docker
  • Next, create a Dockerfile
    • touch Dockerfile
  • Now, edit the Dockerfile how you see fit to create the enviornment that is best for whatever purpose you need to achieve.
  • Once that is all done build the Dockerfile
    • docker build
  • Congratulations, you have built your first docker image!

Commands

  • To run a docker image in a container/volume:
    • docker run -it --rm --mount source=SOURCE,destination=/DESTINATION IMAGE
    • For example, to run an image anything in a container autobike:
      • docker run -it --rm --mount source=autobike,destination=/autobike anything
  • To create a new container:
    • docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
  • To name a docker image:
    • docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
  • To see your docker images:
    • docker image list
  • To see docker volumes:
    • docker volume list
  • To delete a docker image list:
    • docker image rm [OPTIONS] IMAGE [IMAGE...]

When using a container, remember to store the code inside the folder of the container so that changes will be saved.

Vision’s Current Used Dockerfile (as of 12/12/20)

FROM ros:noetic

# install ros package
RUN apt-get update && apt-get install -y \
	vim\
	ros-noetic-ros-tutorials\
	git &&\
	rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash"]