Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xtuc/curltainer

curl anything running inside a Docker container, even with no exposed ports
https://github.com/xtuc/curltainer

curl docker namespace network

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# curltainer

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

## Install

```
cargo install curltainer
```

## Usage

```
Usage: curltainer --container-name [CURL_ARGS]...

Arguments:
[CURL_ARGS]...

Options:
-c, --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
<

...
```