Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BitProcessor committed Apr 9, 2021
1 parent fb04550 commit d77ba14
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 64 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: DockerHub
name: Build docker image

on:
push:
Expand Down Expand Up @@ -29,18 +29,12 @@ jobs:

- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
username: bitprocessor
password: ${{ secrets.CR_PAT }}

- name: Build and push Docker image
Expand All @@ -50,10 +44,7 @@ jobs:
build-args: UTIL_LINUX_VER=${{ steps.get_util_linux.outputs.version }}
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKER_USERNAME }}/nsenter:${{ steps.get_util_linux.outputs.version }}
${{ secrets.DOCKER_USERNAME }}/nsenter:latest
ghcr.io/${{ github.repository_owner }}/nsenter:${{ steps.get_util_linux.outputs.version }}
ghcr.io/${{ github.repository_owner }}/nsenter:latest
ghcr.io/bitprocessor/nsenter:latest
push: true

- name: Image digest
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/cron.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN make LDFLAGS="--static" nsenter

# Final image
FROM scratch

LABEL org.opencontainers.image.source https://github.com/BitProcessor/nsenter
COPY --from=builder /code/util-linux/nsenter /

ENTRYPOINT ["/nsenter"]
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
![DockerHub](https://github.com/alexei-led/nsenter/workflows/DockerHub/badge.svg) ![Docker Pulls](https://img.shields.io/docker/pulls/alexeiled/nsenter.svg?style=popout) [![](https://images.microbadger.com/badges/image/alexeiled/nsenter.svg)](https://microbadger.com/images/alexeiled/nsenter "Get your own image badge on microbadger.com")

# nsenter

## Info

`alexeiled/nsenter` Docker image is a `scratch` image that contains only one statically linked `nsenter` file.

## Usage

Read the official `nsenter` [documentation](http://man7.org/linux/man-pages/man1/nsenter.1.html).

## Continuously Updated with GitHub Actions

The `nsenter` is automatically updated when a new version of [util-linux](https://github.com/karelzak/util-linux) is released.

## How do I *use* `alexeiled/nsenter`?
## How do I *use* `ghcr.io/bitprocessor/nsenter`?

Enter the container:

```sh
# enter all namespaces of selected container
docker run -it --rm --privileged --pid=container:<container_name_or_ID> alexeiled/nsenter --all --target 1 -- su -
docker run -it --rm --privileged --pid=container:<container_name_or_ID> ghcr.io/bitprocessor/nsenter --all --target 1 -- su -
```

Enter the Docker host:

```sh
# enter all namespaces of Docker host
docker run -it --rm --privileged --pid=host alexeiled/nsenter --all --target 1 -- su -
docker run -it --rm --privileged --pid=host ghcr.io/bitprocessor/nsenter --all --target 1 -- su -
```

## Enter Kubernetes node
Expand Down
4 changes: 2 additions & 2 deletions nsenter-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ kubectl run ${podName:?} --restart=Never -it --rm --image overriden --overrides
"containers": [
{
"name": "nsenter",
"image": "alexeiled/nsenter",
"image": "ghcr.io/bitprocessor/nsenter:latest",
"command": [
"/nsenter", "--all", "--target=1", "--", "su", "-"
"/nsenter", "-m", "-u", "-i", "-n", "-p", "-C", "-r", "-w", "--target=1", "--", "su", "-"
],
"stdin": true,
"tty": true,
Expand Down

0 comments on commit d77ba14

Please sign in to comment.