Skip to content

--add-host example doesn't work as shown #5558

Open
@kodedylf

Description

@kodedylf

In the documentation at https://github.com/docker/cli/blob/master/docs/reference/commandline/container_run.md#add-host, a python3 web server is run to server the hello file.

However, as shown, the command will run in the foreground and the user will be unable to run the rest of the commands in the same terminal session. If the user presses ctrl-c to terminate python to be able to run the container, the example won't work since the web server isn't running.

My own solution was to run python3 in the background by adding & to the command. However then I needed to kill the web server after running the container. Getting the pid and killing python isn't very elegant. Hopefully you can come up with a better solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions