Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Copy files from a docker image to host folder #28

Open
davideuler opened this issue Sep 1, 2022 · 0 comments
Open

Copy files from a docker image to host folder #28

davideuler opened this issue Sep 1, 2022 · 0 comments

Comments

@davideuler
Copy link
Owner

davideuler commented Sep 1, 2022

1.Create an output folder in current directory, mount the folder to /output in a temp container,
and then copy the folder in the container to /output. That's all.

mkdir output && docker run --rm --mount type=bind,source="$(pwd)"/output,target=/output jni-faiss cp -r /opt/jni-faiss/cpu /output/

For example, copy linux-command static HTML files from linux-command image:

mkdir -p output && docker run --rm --mount type=bind,source="$(pwd)"/output,target=/output stilleshan/linux-command cp -r /usr/share/nginx/html /output/

2.list tags for a image

put the code to ~/.bash_profile or ~/.zshrc

function listTags() {
    local repo=${1}
    local size=${2:-25}
    local page=${3:-1}
    [ -z "${repo}" ] && echo "Usage: listTags <repoName> [size] [pageIndex]" 1>&2 && return 1
    if [[ $repo == *"/"*  ]]; then
        curl "https://hub.docker.com/v2/repositories/${repo}/tags/?page=${page}&page_size=${size}" 2>/dev/null | jq -r '.results[].name' | sort
    else
        curl "https://registry.hub.docker.com/api/content/v1/repositories/public/library/${repo}/tags?page=${page}&page_size=${size}" 2>/dev/null | jq -r '.results[].name' | sort
    fi
}

Then can listTag of a repository as:

listTags ubuntu
listTags redis
listTags gogs/gogs
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant