Solve the problem of ifconfig being unavailable in docker

Solve the problem of ifconfig being unavailable in docker

Recently, when I was learning docker, I found that ifconfig was used to query the network status in the docker container.

The command not found message appeared. After searching the information, I learned that the images on Docker are installed in the lightest way, and some commands need to be installed by yourself.

Solution:

yum install net-tools

If yum is not available, you can use apt-get install net-tools to solve it

Supplement: Install vim, telnet, ifconfig commands in docker container

When using a docker container, sometimes vim is not installed in it, and when you type the vim command, it prompts: vim: command not found. At this time, you need to install vim, but when you type the apt-get install vim command, it prompts:

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package vim

At this time, you need to type: apt-get update,

The purpose of this command is to synchronize the indexes of the sources listed in /etc/apt/sources.list and /etc/apt/sources.list.d so that the latest software packages can be obtained.

After the update is complete, type the command: apt-get install vim.

apt-get install telnet Install telnet
apt-get install net-tools Install ifconfig

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Docker sets up port mapping, but cannot access the solution
  • How to configure Jupyter notebook in Docker container
  • Docker volume deletion operation
  • The difference between VOLUME and docker -v in Dockerfile
  • Docker implements container port binding local port
  • Docker enables multiple port mapping commands
  • How to install Postgres 12 + pgadmin in local Docker (support Apple M1)

<<:  Detailed explanation of the idea of ​​implementing dynamic columns in angularjs loop object properties

>>:  Solution for applying CSS3 transforms to background images

Recommend

HTML table markup tutorial (18): table header

<br />The header refers to the first row of ...

MySQL 5.7 Common Data Types

——Notes from "MySQL in Simple Terms (Second ...

Will the deprecated Docker be replaced by Podman?

The Kubernetes team recently announced that it wi...

How to import SQL files in Navicat Premium

I started working on my final project today, but ...

Perfect solution for theme switching based on Css Variable (recommended)

When receiving this requirement, Baidu found many...

Detailed explanation of the difference between in and exists in MySQL

1. Prepare in Advance For your convenience, I cre...

js to realize the mouse following game

This article shares the specific code of js to im...

Vue realizes the function of book shopping cart

This article example shares the specific code of ...

Testing of hyperlink opening target

The target attribute of a link determines where th...

Float and Clear Float in Overview Page

1. Float: The main purpose is to achieve the effe...

Two ways to introduce svg icons in Vue

How to introduce svg icons in Vue Method 1 of int...

How to run the react project on WeChat official account

Table of contents 1. Use the a tag to preview or ...