Tag: bash

MYSQL installation errors with docker

I am trying to install mysql from a docker container on rhel6. This is my dockerfile: #HELLO FROM rhel6 MAINTAINER xxxx ADD ./perl /usr/bin/ RUN whereis perl RUN ls -lrt /usr/bin/ RUN yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm -y RUN yum update RUN yum install mysql ADD ./startup.sh /opt/startup.sh EXPOSE 3306 CMD [“/bin/bash”, “/opt/startup.sh”] This is my startup […]

How to show the ID of the oldest running docker container?

I using docker Docker version 1.3.2, build 50b8feb. There are some new filters for the ps command, but it seems nothing provide what I need. I just want to see the oldest container running, to kill it, wait and kill the next oldest one. I hope somebody can come around with some bash magic I […]

Bash Command Templating For Docker

I have a commonly typed and now tedious command to start and link a docker container. It’s something like: docker run -d –name my-running-container –link app:some-app-command –link rabbitmq:amq –link mysql:db –link neo4j:neo –link solr:solr my-image I would prefer to just execute: docker run –name my-running-container my-image How can i achieve this? Thanks

Bash script wait depended commands processes

I am fairly new in bash scripting. I need to use bash script for manage my microservices, so these services need build and deploy(on docker). So I have commands like that : #!/bin/bash mvn clean wait $! mvn package wait $! #Some if elses here sudo docker build -t myService . & wait $! #Some […]

Resolving env inside another env

So i would like to print my env variable which contains other variables. For example i have: MY_VARS=”My var are:\nVAR1 = ${MY_VAR1}\nVAR2 = ${MY_VAR2}” MY_VAR1=var1 MY_VAR2=var2 and i would like to make it possible in way like: printf “${MY_VARS}” > my.conf or printf “$(echo ${MY_VARS})” > my.conf to get sth like in my.conf file: My […]

Access jboss 8080 port inside docker container

I’m running jboss5 in centos6.7 docker contrainer. JBoss running using run.sh -b 0.0.0.0 command Container running using docker run -i -t -p 8080:8080 my/jboss /bin/bash This is what I see in container [root@e44f2bbab31a bin]# netstat -alnt Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:8009 0.0.0.0:* […]

Accessing the number of arguments pass into a docker run command script

I have a docker Entrypoint script that looks like this: #!/bin/sh LABEL=$1 mkdir -p /backup/$LABEL … I can access the arguments passed in the normal bash way via $1, $2, etc. but I also need to know the number of arguments passed in. At first I thought I could do this like this: if [ […]

TCP, UDP and HTTP servers inside docker stop immediately after starting the container?

I am to host TCP, UDP and HTTP servers, developed by Java, inside a java docker container. All what I have in the dockerfile is a copy command for the server application and the bash files, which used to run the server/s. However, the servers are stopped some seconds after running the container? I use […]

Prevent request too quickly in bash

I have to enable, start, stop and restart docker in a bash script. The problem is that the command’s are executed with an ssh-connection. So after executing the command the ssh-connection closes. So there is not enough time to start and stop docker. I get this error: start request repeated too quickly for docker.service How […]

Docker bash'ing with find

I am having a hell of a time attempting to get a bash script to work as expected (as it does in a normal bash session) on a Docker run. The goal is to replace all of the symlinked files within the official java container with their actual file within the JAVA_HOME directory, so everything […]

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