curltainer

Crates.iocurltainer
lib.rscurltainer
version1.0.1
sourcesrc
created_at2024-11-23 20:20:18.417992
updated_at2024-11-23 20:30:13.895763
descriptioncurl anything running inside a Docker container, even with no exposed ports
homepage
repositoryhttps://github.com/xtuc/curltainer
max_upload_size
id1458675
size40,852
Sven Sauleau (xtuc)

documentation

README

curltainer

curl anything running inside a Docker container, even with no exposed ports

Install

cargo install curltainer

Usage

Usage: curltainer --container-name <CONTAINER_NAME> [CURL_ARGS]...

Arguments:
  [CURL_ARGS]...

Options:
  -c, --container-name <CONTAINER_NAME>
  -h, --help                             Print help
  -V, --version                          Print version

How it works?

Start a Docker container with a HTTP server, with no ports exposed to the host:

$ docker run -d python python -m http.server 9000
a8c8e9...

curl the server running inside the container from the host:

$ sudo curltainer -c a8c8e9... localhost:9000  -v

*   Trying 127.0.0.1:9000...
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET / HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: SimpleHTTP/0.6 Python/3.13.0
< Date: Sat, 23 Nov 2024 20:16:00 GMT
< Content-type: text/html; charset=utf-8
< Content-Length: 877
<
<!DOCTYPE HTML>
<html lang="en">
...
Commit count: 2

cargo fmt