docker 使用笔记

【声明】本文为AdamsLee原创,转载请注明出自围炉网并保留本文有效链接:docker 使用笔记, 转载请保留本声明!

docker container ls

docker image ls

docker run -itd solidityflattener_solidityflattener /bin/bash

在容器nginx-proxy中开启一个交互模式的终端

docker exec -i -t nginx-proxy /bin/bash

删除dangling image虚悬镜像

docker image prune

docker image rm

删除所有仓库名为 redis 的镜像:

$ docker image rm $(docker image ls -q redis)

删除所有在 mongo:3.2 之前的镜像:

$ docker image rm $(docker image ls -q -f before=mongo:3.2)

docker volume create my-vol

docker volume ls

docker volume inspect my-vol

docker volume rm $(docker volume ls -qf dangling=true)

docker-compose -f docker-compose-standalone.yml up -d

docker-compose up -d –no-deps –build <service_name>

–no-deps – Don't start linked services.

–build – Build images before starting containers.

win10 ethereum docker 安装失败原因

https://github.com/Microsoft/vscode/issues/36630#issuecomment-350063413

docker build -t wrdoclet-solr:v1 .

Docker 容器镜像删除

1.停止所有的container,这样才能够删除其中的images:

docker stop $(docker ps -a -q)

如果想要删除所有container的话再加一个指令:

docker rm $(docker ps -a -q)

2.查看当前有些什么images

docker images

3.删除images,通过image的id来指定删除谁

docker rmi <image id>

想要删除untagged images,也就是那些id为<None>的image的话可以用

docker rmi $(docker images | grep "^<none>" | awk "{print $3}")

要删除全部image的话

docker rmi $(docker images -q)

docker-compose down 失败时处理

$ docker-compose down

Removing network flume_default

ERROR: network flume_default id ad40df4b5b2d20a0c819128d223650fceacaf93a25ae2cd57ee6f84e8600a810 has active endpoints

$ docker network inspect flume_default

[

    {

        "Name": "flume_default",

        "Id": "ad40df4b5b2d20a0c819128d223650fceacaf93a25ae2cd57ee6f84e8600a810",

        "Created": "2018-05-29T12:30:31.738036197Z",

        "Scope": "local",

        "Driver": "bridge",

        "EnableIPv6": false,

        "IPAM": {

            "Driver": "default",

            "Options": null,

            "Config": [

                {

                    "Subnet": "172.25.0.0/16",

                    "Gateway": "172.25.0.1"

                }

            ]

        },

        "Internal": false,

        "Attachable": true,

        "Ingress": false,

        "ConfigFrom": {

            "Network": ""

        },

        "ConfigOnly": false,

        "Containers": {

            "0b2b3c07e182a7e64cbbcf4707d24aae617fd8dd6795804a7b6a3f3284f2420b": {

                "Name": "adamsleeflume",

                "EndpointID": "5ddf2d907add2a61c868cb7ed7ece2fe10978b9875cb9b21c09e5a0be23cb630",

                "MacAddress": "02:42:ac:19:00:02",

                "IPv4Address": "172.25.0.2/16",

                "IPv6Address": ""

            }

        },

        "Options": {},

        "Labels": {

            "com.docker.compose.network": "default",

            "com.docker.compose.project": "flume"

        }

    }

]

adams@DESKTOP-TAT8TOF MINGW64 ~/DockerWorkBench/flume

$ docker network disconnect -f flume_default adamsleeflume

adams@DESKTOP-TAT8TOF MINGW64 ~/DockerWorkBench/flume

$ docker-compose down

Removing network flume_default

此条目发表在未分类分类目录,贴了标签。将固定链接加入收藏夹。