docker
How to execute command from one docker container to another
You have a few options, but the first 2 that come time mind are: In container 1, install the Docker CLI and bind mount /var/run/docker.sock (you need to specify the bind mount from the host when you start the container). Then, inside the container, you should be able to use docker commands against the bind … Read more
How to create a bidirectional link between containers?
Docker 1.10 addresses this very nicely by introducing advanced container networking. (Details: https://docs.docker.com/engine/userguide/networking/dockernetworks/ ) First, create a network. The example below creates a basic “bridge” network, which works on one host only. You can check out docker’s more complete documentation to do this across hosts using an overlay network. docker network create my-fancy-network Docker networks … Read more
Access to mysql container from other container
The –link flag is considered a legacy feature, you should use user-defined networks. You can run both containers on the same network: docker run -d –name php_container –network my_network my_php_image docker run -d –name mysql_container –network my_network my_mysql_image Every container on that network will be able to communicate with each other using the container name … Read more
How to execute a script when I terminate a docker container
The docker stop command attempts to stop a running container first by sending a SIGTERM signal to the root process (PID 1) in the container. If the process hasn’t exited within the timeout period a SIGKILL signal will be sent. In practice, that means that you have to define an ENTRYPOINT script, which will intercept … Read more
run apps using audio in a docker container
it took me some time until i found out what is needed. (Ubuntu) we start with the docker run command docker run -ti –rm myContainer sh -c “echo run something” ALSA: we need /dev/snd and some hardware access as it looks like. when we put this together we have docker run -ti –rm \ -v … Read more
Docker SQL bind: An attempt was made to access a socket in a way forbidden by its access permissions
I was able to fix it by running: net stop winnat net start winnat Source: https://github.com/docker/for-win/issues/9272#issuecomment-776225866
Port forwarding in docker-machine?
You can still access the VBoxmanage.exe command from the VirtualBox used by docker machine: VBoxManage controlvm “boot2docker-vm” natpf1 “tcp-port27017,tcp,,27017,,27017”; Use docker-machine info to get the name of your vm. use modifyvm if the vm isn’t started yet. See a practical example in this answer. That is the current workaround, pending the possibility to pass argument … Read more
Kubenetes: Is it possible to hit multiple pods with a single request in Kubernetes cluster
[*] Provided you got kubectl in your pod and have access to the api-server, you can get all endpoint adressess and pass them to curl: kubectl get endpoints <servicename> \ -o jsonpath=”{.subsets[*].addresses[*].ip}” | xargs curl Alternative without kubectl in pod: the recommended way to access the api server from a pod is by using kubectl … Read more