Difference between revisions of "Docker"

From Bike Wiki
Jump to navigation Jump to search
(Commands)
(Docker)
Line 7: Line 7:
 
===Docker on Linux===
 
===Docker on Linux===
 
*To install:
 
*To install:
** For Ubuntu:
+
**For Ubuntu:
 
***<code> sudo apt-get install docker </code>
 
***<code> sudo apt-get install docker </code>
** For Red Hat:
+
**For Red Hat:
 
***<code> sudo yum install docker </code>
 
***<code> sudo yum install docker </code>
** For Fedora:
+
**For Fedora:
 
***<code> sudo dnf install docker -y </code>
 
***<code> sudo dnf install docker -y </code>
** For Arch:
+
**For Arch:
 
***<code> sudo pacman -S docker </code>
 
***<code> sudo pacman -S docker </code>
  
Line 19: Line 19:
 
**<code> sudo systemctl enable docker.service </code>
 
**<code> sudo systemctl enable docker.service </code>
  
===Docker on Windows===
+
===Docker With Pain (Windows)===
 
Use the “edge” version or else it won’t like the windows version
 
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.
  
 
===Commands===
 
===Commands===
* To run a docker image in a container/volume:
+
*To run a docker image in a container/volume:
 
**<code>docker run -it --rm --mount source=SOURCE,destination=/DESTINATION IMAGE</code>
 
**<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>:
+
 
 +
**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>
 
***<code>docker run -it --rm --mount source=autobike,destination=/autobike anything</code>
* To create a new container:
+
 
 +
*To create a new container:
 
**<code>docker create [OPTIONS] IMAGE [COMMAND] [ARG...]</code>
 
**<code>docker create [OPTIONS] IMAGE [COMMAND] [ARG...]</code>
* To name a docker image:  
+
 
 +
*To name a docker image:  
 
**<code>docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]</code>
 
**<code>docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]</code>
* To see your docker images:
+
 
 +
*To see your docker images:
 
**<code>docker image list</code>
 
**<code>docker image list</code>
* To see docker volumes:
+
 
 +
*To see docker volumes:
 
**<code>docker volume list</code>
 
**<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.
 
When using a container, remember to store the code inside the folder of the container so that changes will be saved.
  
Line 40: Line 52:
 
<code>
 
<code>
 
FROM ros:noetic
 
FROM ros:noetic
 +
 +
# install ros package
 
RUN apt-get update && apt-get install -y \
 
RUN apt-get update && apt-get install -y \
 
vim\
 
vim\

Revision as of 19:57, 12 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:
    • 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.

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

  1. 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"]