Tag: bash

boot2docker bash command line is very slow

Followed a few tutorials online regarding installing boot2docker ISO release v1.3.0 on a windows 7 enterprise machine. The same steps work fine on a mac!!! We’ve a number of custom docker files that I want to link and manage for our development environment. However, when I run the boot2docker from the desktop it can take […]

Automatically enter only running docker container

In the cloud, I have multiple instances, each running a container with a different random name, e.g.: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5dc97950d924 aws_beanstalk/my-app:latest “/bin/sh -c ‘python 3 hours ago Up 3 hours 80/tcp, 5000/tcp, 8080/tcp jolly_galileo To enter them, I type: sudo docker exec -it jolly_galileo /bin/bash Is there a command […]

How to wait for postgres startup in ENTRYPOINT?

What would be the best approach to wait for postgres to fully start up inside my ENTRYPOINT before moving on executing nosetests? Right now I’ve timed the startup on my machine to around 50 seconds. So I’m just sleeping for 60 seconds. This does not feel good as this might not work when being run […]

My boot2docker installation seems to not be working. What am I doing wrong?

New to Docker. I need it for a project I’m working on but also just to learn. Please bare with me as I am a noob at this and have no idea what any of this means yet. I’m running on Mac OS X 10.6.8 Snow Leopard. FYI: I can’t upgrade my OS so that […]

Can't set docker-machine environment variables bash

I’ using bash 4.3 and I can’t export or set docker-machine environment variables bash-4.3$ docker-machine env default set -gx DOCKER_TLS_VERIFY “1”; set -gx DOCKER_HOST “tcp://”; set -gx DOCKER_CERT_PATH “/Users/ofolorunso/.docker/machine/machines/default”; set -gx DOCKER_MACHINE_NAME “default”; # Run this command to configure your shell: # eval (docker-machine env default) Apparently bash doesn’t recognize the g flag bash-4.3$ eval […]

Bash multiple port mapping depending on script argument

I have a script that accepts as an argument; then my script has to create a docker container with a number of port mapping depending on this argument; for example, if i run ./myscript.sh 10, myscript.sh has to create a docker container with 10 port mapping. This is my myscript.sh #!/bin/bash NCACHES=$1 PORT_BASE=80 docker run […]

Create JSON using jq from pipe-separated keys and values in bash

I am trying to create a json object from a string in bash. The string is as follows. CONTAINER|CPU%|MEMUSAGE/LIMIT|MEM%|NETI/O|BLOCKI/O|PIDS nginx_container|0.02%|25.09MiB/15.26GiB|0.16%|0B/0B|22.09MB/4.096kB|0 The output is from docker stats command and my end goal is to publish custom metrics to aws cloudwatch. I would like to format this string as json. { “CONTAINER”:”nginx_container”, “CPU%”:”0.02%”, …. } I have […]

Dockerfile Overriding ENV variable

I have a Dockerfile and I’d like to make the API configurable with a default value. FROM socialengine/nginx-spa ENV API_URL localhost:6007 So when I run this image I’d to be able to override the localhost:6007 with something like below: docker run -e API_URL=production.com:6007 ui This doesn’t work and I can’t find a clear explanation of […]

exporting DOCKER_HOST in .bashrc produces a different result to the same command in the terminal

Before I can use my docker container (using Boot2Docker on OSX) I always have to remember to enter export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 in my terminal, and naturally I often forget this. So I figured I’d just add that line to my ~/.bashrc file but when I’ve done this and check the value of DOCKER_HOST it’s […]

How to check if docker is running or not

I am new to docker. I am writing a simple script for docker. I need to check whether docker is running or not. Is there a command to check with container name

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