Skip to content

use --network=host how to qemu-x86_64-static #208

@xjj1001

Description

@xjj1001

/kind question

  1. I started a Docker container with x86_64 architecture and installed qemu-x86_64 static using binary packages in the container
docker run -it --rm --privileged --net=host --name temp-x86-container x86-image-name:tag
  1. Then I will export this container and upload it to my arm64 architecture server
docker export temp-x86-container > temp-x86-container.tar
  1. Afterwards, load this image on my arm64 architecture server using the following method
docker import -c "ENTRYPOINT /usr/bin/qemu-x86_64-static /bin/sh" temp-x86-container.tar arm-image-name:tag
  1. I started a container using this image and used the webstart command to start a web service inside the container
docker run -it -net=host --name arm-container arm-image-name:tag webstart

But I found that I cannot access this web service on the host computer
After entering the container, I found that the IP address inside the container was not the same as the host machine. It seems that the host mode has no effect on qemu-x86-64-static. How can I correctly use qemu-x86-64-static to achieve service access

qemu-user-static version : v5.2.0-11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions