Can I specify the IP address of the docker container?

Release: 2020-03-31 09:56:14
Original
2340 people have browsed it

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
Copy after login

First create a docker network type

#docker network create --subnet=172.18.0.0/16 assign
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template