GithubHelp home page GithubHelp logo

docker-cp's Introduction

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
        id: docker-run
        with:
          image: user/app:latest
          options: --name test-app -d
          args: sleep 10

      - name: Copy from container to host
        uses: tj-actions/docker-cp@v2
        with:
          container: ${{ steps.docker-run.outputs.container-id }}
          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
        id: docker-run
        with:
          image: user/app:latest
          options: --name test-app -d
          args: sleep 10
      
      - name: Copy from host to container
        uses: tj-actions/docker-cp@v2
        with:
          container: ${{ steps.docker-run.outputs.container-id }}
          source: test.txt
          destination: test.txt
          local: false
      
      - name: Display contents of test.txt
        run: docker exec ${{ steps.docker-run.outputs.container-id }} cat test.txt

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
container string true Container name
destination string true Destination file or directory
local string false "true" Copy from container to local
(i.e container to host)
options string false Additional options passed to docker cp
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.

docker-cp's People

Contributors

dependabot[bot] avatar jackton1 avatar renovate[bot] avatar repo-ranger[bot] avatar tj-actions-bot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

docker-cp's Issues

Error remedy unclear from documentation

Hi there,

With the following action, I'm unclear as to why I'm getting the error "Error response from daemon: Could not find the file /home/pptruser/test.pdf in container "

  run_tests:
    needs: deploy-to-test-host
    runs-on: ubuntu-latest  # You can choose the appropriate runner

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: puppeteer-test
        uses: tj-actions/[email protected]
        id: puppeteer-test
        with:
          files: |
            test/*.js
  
      - name: Copy test output
        uses: tj-actions/docker-cp@v2
        with:
          container: ${{ steps.puppeteer-test.outputs.container-id }}
          source: ${{ steps.puppeteer-test.outputs.home }}/test.pdf
          destination: test.pdf

      - name: Display contents of test.pdf
        run: cat test.pdf 

Output:

Running test/*.js...
Completed executing test/*.js
0s
Run tj-actions/docker-cp@v2
  with:
    container: be7bd3e17c75
    source: /home/pptruser/test.pdf
    destination: test.pdf
    local: true
Run # Run docker cp
  # Run docker cp
  EXTRA_ARGS=
  
  if [ "true" != "true" ]; then
    docker cp $EXTRA_ARGS /home/pptruser/test.pdf be7bd3e17c75:test.pdf
  else
    docker cp $EXTRA_ARGS be7bd3e17c75:/home/pptruser/test.pdf test.pdf
  fi
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  
Error response from daemon: Could not find the file /home/pptruser/test.pdf in container be7bd3e17c75
Error: Process completed with exit code 1.

It's unclear from the documentation how to remedy?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • alpine 3.19.1
github-actions
.github/workflows/rebase.yml
  • actions/checkout v4
  • cirrus-actions/rebase 1.8
.github/workflows/sync-release-version.yml
  • actions/checkout v4
  • tj-actions/release-tagger v4
  • tj-actions/sync-release-version v13
  • tj-actions/git-cliff v1
  • peter-evans/create-pull-request v6
.github/workflows/test.yml
  • actions/checkout v4
  • reviewdog/action-shellcheck v1
  • docker/setup-qemu-action v3.0.0
  • docker/setup-buildx-action v3.3.0
  • docker/build-push-action v5
  • tj-actions/docker-run v2
.github/workflows/update-readme.yml
  • actions/checkout v4
  • tj-actions/auto-doc v3
  • tj-actions/remark v3
  • tj-actions/verify-changed-files v19
  • peter-evans/create-pull-request v6

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.