Home >Operation and Maintenance >Docker >Can I specify the IP address of the docker container?

Can I specify the IP address of the docker container?

尚
Original
2020-03-31 09:56:142371browse

Can I specify the IP address of the docker container?

You can specify the IP of the docker container. Let's take a look at how to specify the IP of the docker container:

Check the type of docker network type on the host

# docker network ls            
NETWORK ID    NAME      DRIVER   SCOPE
e3357d59b80c   bridge      bridge   local
8d713894b43d    host      host    local
c830c6e84f65    none      null    local

First create a docker network type

#docker network create --subnet=172.18.0.0/16 assign

Specify the IP to start the docker container

#docker run -i -t --net assign --ip 172.18.0.2 kamailio-4.3:base /bin/bash                 
#yum install -y net-tools.x86_64
#ifconfig

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of Can I specify the IP address of the docker container?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn