Docker Tips

Sep 22, 2018

clean all none images

$ docker rmi $(docker images -q -f "dangling=true")

delete images with grep

$ docker rmi $(docker images | grep hacker | awk '{print $1','$2}' | sed  "s/ /:/g")

the linux vm used by Docker for Mac

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
# Login as root. No password necessary
# To quit the screen app,type CTRL-A, then CTRL-\

use customer network in docker-compose

$ docker network create --driver=bridge --subnet=10.50.0.0/16 mynetwork
networks:
  default:
    external:
      name: mynetwork