Skip to content

Commit

Permalink
Merge branch 'master' into no-delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
lavie authored Oct 25, 2022
2 parents 12c862f + 86666d0 commit 87f5b21
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 66 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: pip install poetry
- run: poetry install
- run: docker login -u assaflavie -p "$DOCKERHUB_PASSWORD"
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- run: make test
- if: ${{ failure() }}
run: ./inspect_fixtures.sh
8 changes: 5 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: pip install poetry
- run: poetry install
- run: docker login -u assaflavie -p "$DOCKERHUB_PASSWORD"
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Log into Dockerhub
uses: docker/login-action@v2
with:
username: assaflavie
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make pypi push
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This prints out what you need to run to get a similar container. You can do `$(r
--detach=true \
myrepo/redis:7860c450dbee9878d5215595b390b9be8fa94c89 \
redis-server --slaveof 172.31.17.84 6379

Feeding it the output of `docker inspect` also works:

```
Expand All @@ -35,7 +35,7 @@ docker inspect <container-name> | runlike --stdin

## Run without installing

`runlike` is packaged as a Docker image: [assaflavie/runlike](https://hub.docker.com/r/assaflavie/runlike/).
`runlike` is packaged as a Docker image: [assaflavie/runlike](https://hub.docker.com/r/assaflavie/runlike/).

```
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
Expand Down Expand Up @@ -102,13 +102,15 @@ Probably **shouldn't use this in production** yet. If you do, double check that
the host
--restart string Restart policy to apply when a
container exits (default "no")
--rm Automatically remove the container
when it exits
--runtime string Runtime to use for this container
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID (format:
<name|uid>[:<group|gid>])
-v, --volume list Bind mount a volume
--volumes-from list Mount volumes from the specified
container(s)
container(s)
-w, --workdir string Working directory inside the container
```
Expand Down Expand Up @@ -211,8 +213,6 @@ Probably **shouldn't use this in production** yet. If you do, double check that
--read-only Mount the container's root
filesystem as read only
--rm Automatically remove the container
when it exits
--security-opt list Security Options
--shm-size bytes Size of /dev/shm
--sig-proxy Proxy received signals to the
Expand Down
1 change: 1 addition & 0 deletions fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ sudocker run -d --name runlike_fixture4 \

sudocker rm -f runlike_fixture5
sudocker run -d --name runlike_fixture5 \
--rm \
--link runlike_fixture4:alias_of4 \
--link runlike_fixture1 \
runlike_fixture
Expand Down
126 changes: 72 additions & 54 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "runlike"
version = "1.4.0"
version = "1.4.2"
description = "Reverse-engineer docker run command line arguments based on running containers"
authors = ["Assaf Lavie <a@assaflavie.com>"]
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions runlike/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ def format_cli(self):
if self.get_fact("Config.Tty"):
self.options.append('-t')

if self.get_fact("HostConfig.AutoRemove"):
self.options.append('--rm')

parameters = ["run"]
if self.options:
parameters += self.options
Expand Down
3 changes: 3 additions & 0 deletions test_runlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def test_tty(self):
self.expect_substr('-t \\')
self.dont_expect_substr('-t \\', 2)

def test_autoremove(self):
self.expect_substr('--rm \\', 5)

def test_restart_always(self):
self.expect_substr('--restart=always \\')

Expand Down

0 comments on commit 87f5b21

Please sign in to comment.