Skip to content

Instantly share code, notes, and snippets.

@christianberg
Last active April 14, 2025 13:47
Show Gist options
  • Save christianberg/eaec4028fbb77a0c3c8c to your computer and use it in GitHub Desktop.
Save christianberg/eaec4028fbb77a0c3c8c to your computer and use it in GitHub Desktop.

Revisions

  1. christianberg revised this gist Aug 20, 2014. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,23 @@
    - Build the image from the Dockerfile above:

    docker build --rm -t cberg-test .

    ```
    docker build --rm -t cberg-test .
    ```

    - Run a container, sharing the host dir `/root/foo`:

    docker run --rm -v /root/foo:/foo cberg-test
    ```
    docker run --rm -v /root/foo:/foo cberg-test
    ```

    - In another shell, write something to the socket (which was created in `/root/foo` by the container):

    echo 'hello docker' | socat - UNIX-CONNECT:/root/foo/bar.sock
    ```
    echo 'hello docker' | socat - UNIX-CONNECT:/root/foo/bar.sock
    ```

    - See the output of the container in the first shell:

    hello docker
    ```
    hello docker
    ```
  2. christianberg created this gist Aug 20, 2014.
    8 changes: 8 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    FROM ubuntu

    RUN apt-get update
    RUN apt-get install -y socat

    VOLUME /foo

    CMD socat UNIX-LISTEN:/foo/bar.sock -
    15 changes: 15 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    - Build the image from the Dockerfile above:

    docker build --rm -t cberg-test .

    - Run a container, sharing the host dir `/root/foo`:

    docker run --rm -v /root/foo:/foo cberg-test

    - In another shell, write something to the socket (which was created in `/root/foo` by the container):

    echo 'hello docker' | socat - UNIX-CONNECT:/root/foo/bar.sock

    - See the output of the container in the first shell:

    hello docker