docker network create --driver=bridge --subnet=172.28.0.0/16 --ip-range=172.28.5.0/24 --gateway=172.28.5.254 br0 -o com.docker.network.bridge.name=br0
修改ip addr网卡名称
docker network list
查看系统默认docker0(20d5d1508381)的底层信息
[root@docker2 ~]# docker netwrok inspect 20d5d1508381
…
}
},
“Options”: {
“com.docker.network.bridge.default_bridge”: “true”,
“com.docker.network.bridge.enable_icc”: “true”,
“com.docker.network.bridge.enable_ip_masquerade”: “true”,
“com.docker.network.bridge.host_binding_ipv4”: “0.0.0.0”,
“com.docker.network.bridge.name": "docker0”, #注意这个命令行
“com.docker.network.driver.mtu”: “1500”
},
“Labels”: {}
}
]
docker network inspect [OPTIONS] NETWORK [NETWORK...]
docker network prune [OPTIONS] Remove all unused networks. Unused networks are those which are not referenced by any containers.
docker network rm 3695c422697f|my-network
docker search
docker pull
docker commit
docker commit [OPTIONS] ConTAINER [REPOSITORY[:TAG]] Create a new image from a container’s changes
docker export
docker export [OPTIONS] ConTAINER Export a container’s filesystem as a tar archive
docker import
docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]] import the contents from a tarball to create a filesystem image docker import https://example.com/exampleimage.tgz
docker load
docker load [OPTIONS] docker image ls docker load < busybox.tar.gz docker images docker load --input fedora.tar docker images
docker save
docker save busybox > busybox.tar ls -sh busybox.tar docker save --output busybox.tar busybox
docker info
docker inspect
Get an instance’s IP addressFor the most part, you can pick out any field from the JSON in a fairly straightforward manner.
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $INSTANCE_ID
Get an instance’s MAC address docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' $INSTANCE_ID
Get an instance’s log path docker inspect --format='{{.LogPath}}' $INSTANCE_ID
Get an instance’s image name docker inspect --format='{{.Config.Image}}' $INSTANCE_ID
List all port bindings You can loop over arrays and maps in the results to produce simple text output:
docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
Find a specific port mapping The .Field syntax doesn’t work when the field name begins with a number, but the template language’s index function does. The .NetworkSettings.Ports section contains a map of the internal port mappings to a list of external address/port objects. To grab just the numeric public port, you use index to find the specific port map, and then index 0 contains the first object inside of that. Then we ask for the HostPort field to get the public address.
docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
Get a subsection in JSON format If you request a field which is itself a structure containing other fields, by default you get a Go-style dump of the inner values. Docker adds a template function, json, which can be applied to get results in JSON format.
docker inspect --format='{{json .Config}}' $INSTANCE_ID
docker kill my_container Send a KILL signal to a container
docker rename
docker rename ConTAINER NEW_NAME
docker restart
docker restart [OPTIONS] ConTAINER [CONTAINER...]
docker rm
docker rm [OPTIONS] ConTAINER [CONTAINER...]
docker rmi
docker rmi [OPTIONS] IMAGE [IMAGE...]
docker run
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
docker run --name test -it debian
docker run -t -i --rm ubuntu bash
docker run -t -i --privileged ubuntu bash
docker run -w /path/to/dir/ -i -t ubuntu pwd
docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
docker run --read-only -v /icanwrite busybox touch /icanwrite/here
docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/static-docker-binary:/usr/bin/docker busybox sh
docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
docker run --read-only --mount type=volume,target=/icanwrite busybox touch /icanwrite/here
docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash
docker run -itd --network=my-net --ip=10.10.9.75 busybox
docker run --restart=always redis
noon-failure[:max-retries]unless-stopped always
docker run --sysctl net.ipv4.ip_forward=1 someimage
docker start [OPTIONS] ConTAINER [CONTAINER...]
docker stop [OPTIONS] ConTAINER [CONTAINER...]
- docker image lsrmpull
- docker container ls -astoprmstartrestart
- /var/lib/docker/containers
注意:先关闭docker,再修改配置文件
systemctl stop docker



