User Tools

Site Tools


qnote:docker

Быстрые заметки по Docker

Запустить одноразовый контейнер с Debian

[root@docker1 ~]# docker run -ti --rm --name debian debian
Unable to find image 'debian:latest' locally
latest: Pulling from library/debian
0a9573503463: Pull complete 
Digest: sha256:7d3e8810c96a6a278c218eb8e7f01efaec9d65f50c54aae37421dc3cbeba6535
Status: Downloaded newer image for debian:latest
root@e97a5e2d9c78:/# 

Запустить одноразовый контейнер с Centos7

[root@docker1 ~]# docker run -ti --rm --name centos1 centos:7
Unable to find image 'centos:7' locally
7: Pulling from library/centos
2d473b07cdd5: Pull complete 
Digest: sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
Status: Downloaded newer image for centos:7
[root@63edd48ce181 /]# 

Посмотреть сеть

[root@docker1 ~]# docker network inspect bridge
[
    {
        "Name": "bridge",
        "Id": "8bbd7812b6963c0c8beae6aab5e73d67d5d742d6040869ef00ea375376a7d1c0",
        "Created": "2022-12-05T16:35:13.79226766+03:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "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": {}
    }
]

Удалить сеть

[root@docker1 ~]# docker network rm network-10
network-10

Создать сеть с драйвером bridge

[root@docker1 ~]# docker network create -d bridge --subnet 10.0.0.0/24 --gateway 10.0.0.1 network-10
9317851810e0b305df95f60d7d9a4a131b2e27a9e42ffa88c406cfa07e5846da

Важно, при задании subnet, не пересекаться с сетью настроенной на “физ” интерфейсе хостовой машины.


qnote/docker.txt · Last modified: 2024/04/07 09:43 by k

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki