Tag: bash

Bash script behaves differently from Docker run command instead of inside container itself?

I am running the Docker 1.0.1 client on Ubuntu 12.0.4 LTS. I have a container that runs a Java application in server mode. There is a Bash script in the container that launches the server. If I execute the bash script from inside the container’s the Java application runs fine. If I append the bash […]

docker automatically commit and push

I’m trying to setup a GUI application in docker to use it on different computers with the exact same configuration. The container is working but I always have to commit and push the changes manually. Is there a way to automatically commit and push the changes of the docker container after the container was stopped […]

Sending a file as a parameter to a container in order to be compiled causes problems

I’m facing some problems when sending a file to a docker container in order to be compiled and executed. In the folder that I’m running the command I have a “compiler” folder and a file.cpp(a basic hello world”). I’m using this command: sudo docker run –rm -it -v /compiler/ dockcompiler file.cpp And this is the […]

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 [ […]

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