Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
refresh-cw

GitHub Action

Docker Copy

v2.0.0

Docker Copy

refresh-cw

Docker Copy

Run steps using docker

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Docker Copy

uses: tj-actions/[email protected]

Learn more about this action in tj-actions/docker-cp

Choose a version

CI Update release version. Public workflows that use this action.

docker-cp

GitHub action to run steps using docker

Examples

Copy from container to host

...
    steps:
      - uses: actions/checkout@v2

      - name: Set up QEMU
        uses: docker/[email protected]

      - name: Set up Docker Buildx
        uses: docker/[email protected]

      - name: Build
        uses: docker/build-push-action@v3
        with:
          context: .
          load: true
          push: false
          tags: user/app:latest

      - name: Run
        uses: tj-actions/docker-run@v2
        with:
          image: user/app:latest
          options: --name test-app -d
          args: sleep 10000

      - name: Copy from container to host
        uses: tj-actions/docker-cp@v1
        with:
          container: test-app
          source: test.txt
          destination: test.txt
      
      - name: Display contents of test.txt
        run: cat test.txt
        # Hello World

Copy from host to container

...
    steps:
      - uses: actions/checkout@v2

      - name: Set up QEMU
        uses: docker/[email protected]

      - name: Set up Docker Buildx
        uses: docker/[email protected]

      - name: Build
        uses: docker/build-push-action@v3
        with:
          context: .
          load: true
          push: false
          tags: user/app:latest

      - name: Create test.txt
        run: echo "Hello World" >> test.txt

      - name: Run
        uses: tj-actions/docker-run@v2
        with:
          image: user/app:latest
          options: --name test-app -d
          args: sleep 10000
      
      - name: Copy from host to container
        uses: tj-actions/docker-cp@v1
        with:
          container: test-app
          source: test.txt
          destination: test.txt
          local: true
      
      - name: Display contents of test.txt
        run: docker exec test-app cat test.txt

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
container string true Container name
destination string true Destination file or directory
local string false "false" Copy from local to container
options string false Additional options
source string true Source file or directory

If you feel generous and want to show some extra appreciation:

Buy me a coffee

Credits

This package was created with Cookiecutter using cookiecutter-action

Report Bugs

Report bugs at https://github.com/tj-actions/docker-cp/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your workflow that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.