docker-run

How to run script in docker container with additional capabilities (docker exec … --cap-add …)

元气小坏坏 提交于 2021-01-29 09:21:47
问题 How can I run a script in a docker container with additional capabilities, such as NET_ADMIN ? I'm testing out some commands that I'd like to run in a docker image that require the NET_ADMIN permissions. For example, this works: docker run --rm -it --cap-add 'NET_ADMIN' debian:stable-slim "iptables -L" But if I want to execute a script (via docker exec ), then suddenly the --cap-add option is not available. root@disp8686:~# cat << EOF > docker_script.sh > apt-get update > apt-get -y install

'docker run' using mount volume option '-v' with single directory as parameter (no source and destination split with colon mark (“:”))

可紊 提交于 2021-01-29 07:17:57
问题 On this page https://mherman.org/blog/dockerizing-an-angular-app/ , At some point in this tutorial there is this command to launch the container: $ docker run -v ${PWD}:/app -v /app/node_modules -p 4201:4200 --rm example:dev . I don't understand the -v /app/node_modules part. What is the purpose of -v when there are no source and destination split by a colon mark? I've been reading official documentation: https://docs.docker.com/engine/reference/commandline/run/#mount-volume--v---read-only ;

Unable to find docker image locally

北城余情 提交于 2020-01-14 08:04:35
问题 I was following this post - the reference code is on GitHub. I have cloned the repository on my local. The project has got a react app inside it. I'm trying to run it on my local following step 7 on the same post: docker run -p 8080:80 shakyshane/cra-docker This returns: Unable to find image 'shakyshane/cra-docker:latest' locally docker: Error response from daemon: pull access denied for shakyshane/cra-docker, repository does not exist or may require 'docker login'. See 'docker run --help'. I

Set GOOGLE_APPLICATION_CREDENTIALS in Docker

喜夏-厌秋 提交于 2020-01-03 17:20:25
问题 I want to set GOOGLE_APPLICATION_CREDENTIALS inside my docker container using my key.json file but I don't want to copy this file into my container. 回答1: If you want to set credentials using docker run, you can supply the file with the --env-file flag, or supply the arguement with --env The tricky part is, since it's in json, you would have to cat the json file, grep the variable you're looking for, replace the colon with =, and remove the brackets. That's a lot of work. Instead, why don't

How bad is it to pipe process to consumer in ENTRYPOINT?

落爺英雄遲暮 提交于 2019-12-11 07:38:50
问题 How bad would it be to use something like this in a Dockerfile: ENTRYPOINT node . | tee >(send_logs_to_elastic_search) most of the logging solutions require some pretty nasty configuration. The above would be a way for us to capture the logs programmatically and write our own glue code. The main problem with the above solution is that CMD arguments would not append to the node process? I assume they would get append to the tee process instead? something like this: docker run foo --arg1 --arg2

Permission denied to Docker daemon socket at unix:///var/run/docker.sock

落爺英雄遲暮 提交于 2019-12-03 13:11:48
问题 I have this Dockerfile : FROM chekote/gulp:latest USER root RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y sudo libltdl-dev ARG dockerUser='my-user-name'; ARG group='docker'; # crate group if not exists RUN if ! grep -q -E "^$group:" /etc/group; then groupadd $group; fi # create user if not exists RUN if ! grep -q -E "^$dockerUser:" /etc/passwd; then useradd -c 'Docker image creator' -m -s '/bin/bash' -g $group $dockerUser; fi # add user to the group (if it was present and