[Error] Unable to look up hostname with ns unshared.
- Linguagem predominante
- Go
- Estrelas
- 13k
- Forks
- 541
- Merge médio
- 20h 47min
- PRs com merge (30d)
- 4
Descrição
**Describe the bug**
So I tried to run an application that requires running `hostname -i`, but with isolated network (bridge).
**To Reproduce**
Steps to reproduce the behavior
```bash
distrobox create -i archlinux --unshare-netns
distrobox enter archlinux -- hostname -i
```
**Expected behavior**
Show the ip address of the hostname immediately
**Logs**
```
~ via v25.9.0 via 🐍 v3.14.4 took 5s
❯ distrobox create -i archlinux --unshare-netns
Image archlinux not found.
Do you want to pull the image now? [Y/n]: y
Resolved "archlinux" as an alias (/etc/containers/registries.conf.d/00-shortnames.conf)
Trying to pull docker.io/library/archlinux:latest...
Getting image source signatures
Copying blob 1dd624a5d250 done |
Copying blob ab6ef42a20b3 done |
Copying config c26b5ec8ec done |
Writing manifest to image destination
c26b5ec8ec89a92d0189a76aa40a864b8c70f9a6feb1353c45b3d85981c3629f
Creating 'archlinux' using image archlinux [ OK ]
Distrobox 'archlinux' successfully created.
To enter, run:
distrobox enter archlinux
~ via v25.9.0 via 🐍 v3.14.4 took 31s
❯ distrobox enter archlinux -- hostname -i
wStarting container... [ OK ]
Installing basic packages... bu [ OK ]
Setting up devpts mounts... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up distrobox profile... [ OK ]
Setting up sudo... [ OK ]
Setting up user's group list... [ OK ]
Setting up existing user - shell... [ OK ]
Setting up existing user - groups... [ OK ]
Ensuring user's access... [ OK ]
Container Setup Complete!
buhostname: gethostbyname: Unknown host
```
**Desktop (please complete the following information):**
- Are you using podman, docker or lilipod? docker
- Which version or podman, docker or lilipod? Docker version 29.4.1, build 055a478ea9
- Which version of distrobox? distrobox: 1.8.2.4
- Which host distribution? Arch
- How did you install distrobox? Pacman
**Additional context**
None
Guia de contribuição
Direção de pesquisa
O problema ocorre ao entrar em um contêiner distrobox com --unshare-netns e executar 'hostname -i'. Comece examinando o script de entrada do contêiner e a configuração do namespace de rede no código-fonte do distrobox. Procure como a resolução de nomes de host é tratada em contextos de rede isolados. Teste a correção modificando os scripts relevantes e verificando se 'hostname -i' retorna corretamente um endereço IP dentro do namespace de rede não compartilhado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- docker, shell
- Domínio
- cli, networking
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Pouca atividade
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 65/100