Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Cheatsheet #174

Open
AllanChain opened this issue Jul 31, 2021 · 0 comments
Open

Docker Cheatsheet #174

AllanChain opened this issue Jul 31, 2021 · 0 comments
Labels
blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg @post This is a blog post tag: docker |108685840-96de5d00-752f-11eb-91df-f5e884d827bf.png

Comments

@AllanChain
Copy link
Owner

AllanChain commented Jul 31, 2021

View Post on Blog

Docker

Docker commands are easily forgotten


Above image from scmagazine.com

Cleaning

Remove dangling images

docker image prune

Or remove:

  • all stopped containers
  • all networks not used by at least one container
  • all dangling images
  • all dangling build cache
docker system prune

Updating

Update images managed by Docker compose:

docker compose pull
docker compose up -d --remove-orphans

Removing

docker rmi [image name]
docker rm [container name]

Expose Port

docker run -p [host port]:[container port]

Using Buildx to build image for ARM

docker buildx build \
          --tag your-username/multiarch-example:latest \
          --platform linux/amd64,linux/arm/v7,linux/arm64 .

Display command output with Buildx

Just add a --progress=plain flag.

Add IPv6

Disclaimer: may be inaccurate

In /etc/docker/daemon.json:

{
  "ipv6": true,
  "fixed-cidr-v6": "2001:3200:1::/64"
}

And run:

sudo systemctl reload docker

This reload is graceful so that you don't need to stop containers.

Then in docker-compose.yml:

services:
  app:
    # ...
    networks:
      - app_net
networks:
  app_net:
    enable_ipv6: true
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 2001:db8:1::/64
          gateway: 2001:db8:1::1
@AllanChain AllanChain added tag: docker |108685840-96de5d00-752f-11eb-91df-f5e884d827bf.png blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg @post This is a blog post labels Jul 31, 2021
@AllanChain AllanChain added this to Done in Post Process Jul 31, 2021
github-actions bot added a commit that referenced this issue Jul 31, 2021
github-actions bot added a commit that referenced this issue Aug 1, 2021
github-actions bot added a commit that referenced this issue Sep 8, 2021
github-actions bot added a commit that referenced this issue Sep 11, 2021
github-actions bot added a commit that referenced this issue May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg @post This is a blog post tag: docker |108685840-96de5d00-752f-11eb-91df-f5e884d827bf.png
Projects
Post Process
  
Done
Development

No branches or pull requests

1 participant