LoginSignup
0
0

More than 3 years have passed since last update.

docker on raspberry pi

Last updated at Posted at 2020-06-26

Introduction

overview

Install

sudo apt-get update && sudo apt-get upgrade
curl -sSL https://get.docker.com | sh

Setting

Create the docker group.
sudo groupadd docker
Add a Non-Root User to the Docker Group
sudo usermod -aG docker [user_name]
sudo usermod -aG docker ${USER}
sudo usermod -aG docker pi
You would need to loog out and log back in so that your group membership is re-evaluated or type the following command:
su -s ${USER}

Check your env

cat /proc/cpuinfo | grep model
cat /etc/os-release

analyze an image file
https://github.com/wagoodman/dive

Verify

docker run hello-world
docker image pull nginx
docker image inspect nginx

Cheatsheet

PDF

Build

Build an image from the Dockerfile in the current directory and tag the image
docker build -t myimage:1.0 .
List all images that are locally stored with the Docker Engine
docker image ls
Delete an image from the local image store
docker image rm alpine:3.4

Remove all image

docker rmi $(docker images -a -q)
docker container rm $(docker container ls -aq)

Run

docker run -it <image> /bin/bash

Run a container from the Alpine version 3.9 image, name the running container “web” and expose port 5000 externally, mapped to port 80 inside the container.
docker container run --name web -p 5000:80 alpine:3.9
Stop a running container through SIGTERM
docker container stop web
Stop a running container through SIGKILL
docker container kill web
List the networks
docker network ls
List the running containers (add --all to include stopped containers)
docker container ls
Delete all running and stopped containers
docker container rm -f $(docker ps -aq)
Print the last 100 lines of a container’s logs
docker container logs --tail 100 web

Share

Copy Docker images to another host

To get the image id:
sudo docker images
Say you have an image with id(REPOSITORY) "table-data".
Save the image with id:
sudo docker save -o /home/table/table-data.tar table-data
Copy the image from the path to any host. Now import to your local Docker installation using:
sudo docker load -i <path to copied image file>

hub

Choose Docker Base Image Wisely

https://towardsdatascience.com/how-to-build-slim-docker-images-fast-ecc246d7f4a7
https://pythonspeed.com/articles/base-image-python-docker-images/

open cv docker
1.v3 & v4
2.v3

tutorial

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0