docker-exec

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

Enter a docker container running with Google Cloud Run

不问归期 提交于 2020-12-30 06:14:07
问题 Is it possible to enter a container powered by Google Cloud Run? Something in the manner of docker exec -it CONTAINER /bin/bash ? I'm facing a bug i can't reproduce running a container based on the very same image neither locally nor using Google Cloud Shell to run that container. I'm not picky regarding whether it comes to using Cloud Shell to connect to Cloud Run or doing so from my local environment. 回答1: Is it possible to enter a container powered by Google Cloud Run? No, the only port

Enter a docker container running with Google Cloud Run

只谈情不闲聊 提交于 2020-12-30 06:12:13
问题 Is it possible to enter a container powered by Google Cloud Run? Something in the manner of docker exec -it CONTAINER /bin/bash ? I'm facing a bug i can't reproduce running a container based on the very same image neither locally nor using Google Cloud Shell to run that container. I'm not picky regarding whether it comes to using Cloud Shell to connect to Cloud Run or doing so from my local environment. 回答1: Is it possible to enter a container powered by Google Cloud Run? No, the only port

Passing a complex shell script via docker exec sh -c “…”

痴心易碎 提交于 2020-04-17 22:40:45
问题 I have a script that works fine in sh on a linux host as well as inside an alpine container. But when I try executing that using docker exec <containerID> sh -c "<script>" it misbehaves. The script's function is to output stuff similar to ps. systick=$(getconf CLK_TCK); for c in /proc/*/cmdline; do d=$(dirname $c); name=$(grep Name: $d/status); pid=$(basename $d); uid=$(grep Uid: $d/status); uid=$(echo ${uid#Uid:} | xargs); uid=${uid%% *}; user=$(grep :$uid:[0-9] /etc/passwd); user=${user%%:*

Running powershell or cmd on docker container

安稳与你 提交于 2019-12-11 07:19:26
问题 I want to check the content of my docker container. I want to run a powershell or command prompt inside container so I can list directories. This container image is hosting ASP.NET Web API application using ASP.net 4.6.1 framework. I ran following commands: docker container ls - to list conatiners docker exec -i -t a1da40af6b3c powershell But nothing happens (as shown in the image). Am i missing anything? 回答1: ISE hosted powershell does not work properly with a bunch of things. So try to do

How to use Deployer with Docker (Laradock)

倖福魔咒の 提交于 2019-12-10 10:27:11
问题 I created a fresh Digital Ocean server with Docker on it (using Laradock) and got my Laravel website working well. Now I want to automate my deployments using Deployer. I think my only problem is that I can't get Deployer to run docker exec -it $(docker-compose ps -q php-fpm) bash; , which is the command I successfully manually use to enter the appropriate Docker container (after using SSH to connect from my local machine to the Digital Ocean server). When Deployer tries to run it, I get this

How to use Deployer with Docker (Laradock)

青春壹個敷衍的年華 提交于 2019-12-06 05:07:51
I created a fresh Digital Ocean server with Docker on it (using Laradock ) and got my Laravel website working well. Now I want to automate my deployments using Deployer . I think my only problem is that I can't get Deployer to run docker exec -it $(docker-compose ps -q php-fpm) bash; , which is the command I successfully manually use to enter the appropriate Docker container (after using SSH to connect from my local machine to the Digital Ocean server). When Deployer tries to run it, I get this error message: ➤ Executing task execphpfpm [1.5.6.6] > cd /root/laradock && (pwd;) [1.5.6.6] < /root

difference between docker attach and docker exec

眉间皱痕 提交于 2019-11-27 17:34:49
Both will be able to execute commands in container. Both could detach the container. So what is the real difference between docker exec and docker attach? VonC There was a commit PR which added to the doc: Note: This command ( attach ) is not for running a new process in a container. See: docker exec . The answer to " Docker. How to get bash\ssh inside runned container ( run -d )? " illustrates the difference: (docker >= 1.3) If we use docker attach , we can use only one instance of shell . So if we want open new terminal with new instance of container's shell, we just need run docker exec if

difference between docker attach and docker exec

流过昼夜 提交于 2019-11-27 04:12:48
问题 Both will be able to execute commands in container. Both could detach the container. So what is the real difference between docker exec and docker attach? 回答1: There was a commit PR which added to the doc: Note: This command ( attach ) is not for running a new process in a container. See: docker exec . The answer to "Docker. How to get bash\ssh inside runned container (run -d)?" illustrates the difference: (docker >= 1.3) If we use docker attach, we can use only one instance of shell . So if