Tag: bash

Start up script fails with error “-e: invalid option”, what is missing?

The following script is the ENTRYPOINT of my Dockerfile: /config/bootstrap.sh #!/bin/bash set -e set -u # Supervisord default params SUPERVISOR_PARAMS=’-c /etc/supervisord.conf’ mkdir -p /data/conf /data/run /data/logs chmod 711 /data/conf /data/run /data/logs if [ “$(ls /config/init/)” ]; then for init in /config/init/*.sh; do . $init done fi # We have TTY, so probably an interactive container… […]

run vlc in a Docker image to send a video stream via rtsp protocol

I am using Docker for a project. The goal is to play a video in VLC and send the data stream via the RTSP protocol, so that the other machines(user) can see the video on live in their machines. the video, the Dockerfile and the bash file are in the same folder. here is a […]

npm not working after export MSYS_NO_PATHCONV on Git Bash

I’m using Git Bash and Docker for Windows. To do this, I have to export MSYS_NO_PATHCONV=1 before using a docker command, so in my .bashrc I have set : docker() { export MSYS_NO_PATHCONV=1 (“docker.exe” “$@”) export MSYS_NO_PATHCONV= } Unfortunately, after doing this, npm commands are not working : $ npm module.js:471 throw err; ^ Error: […]

docker tool in jenkins container (with mounted docker socket) is not finding docker daemon to connect to

I just started a jenkins docker container with a mounted docker socket like the following: docker run -d \ –publish 8080:8080 \ –publish 50000:50000 \ –volume /my_jenkins_home:/var/jenkins_home \ –volume /var/run/docker.sock:/var/run/docker.sock \ –restart unless-stopped \ –name my_jenkins_container \ company/my_jenkins:latest Then I bash into the container like this: docker exec -it my_jenkins_container bash A tool ‘docker’ command […]

Processing stdout and stderr separately adding a timestamp: Wrong order

These are my test files: std-test.sh: #!/bin/bash for i in {0..20} do number=$RANDOM let “number %= 10” if [ $number -le 6 ] then echo $i; else echo $i 1>&2; fi done process.sh: #!/bin/bash while read line; do [[ $1 = “err” ]] && echo “$(date +%s%3N) $line” >> stderr; [[ $1 = “out” ]] […]

exec not found using Dockerfile ENTRYPOINT

Reading up on the Dockerfile documentation for ENTRYPOINT, I am having an issue trying to rewrite one of my commands: As it runs today, without issues: # Startup ENTRYPOINT [“/etc/init.d/hook”, “/run/apache2/apache2.pid”, “/etc/init.d/apache2 start”] According to various sources, I should fork my hook process using exec, so I have simple changed the entrypoint to ENTRYPOINT [“exec”, […]

Determining if a process runs inside windows/iis

Is there a way to programatically / using bash scripts to identify that we are running inside a Windows based Docker Container (namely, microsoft/iis)?

pipelines fail with custom docker image

I have a custom docker image on docker hub: salmantariq/node_mysql. It has MySQL server installed on it and node via nvm. I get the following error. I am sure I am missing something here but don’t know what. { bash: cannot set terminal process group (9): Not a ttybash: no job control in this shell+ […]

How to sort by name `docker service ls`

I’m using Docker Swarm 1.13.1 and it would be very practical to list services by name (A-Z). I don’t think Docker support this feat by natively so I expect some awk, sort and other little hacks. So far this is the closest I can get: root@N01-par1-dev-e:~/deploy-setup# docker service ls | sort -k2,2 -k1 yru8n6zxmp08 consul […]

Bidirectional communication with 'docker exec -it bash <container_id>' using docker-py

I can’t seem to figure out how to enable async i/o with a container shell session using docker-py SDK. What I am essentially trying to achieve is to have a working equivalent of docker exec -it bash $container_id in docker-py. Obviously, stdout poses no problems. It’s just that there is no (glaringly obvious) way to […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.