FAQ Database Discussion Community


How to run read command inside a Dockerfile?

bash,docker,dockerfile
I have the following bash script command read -r -d '' FILECONTENT <<'ENDFILECONTENT' index index.html; location ~ /\.ht { deny all; } ENDFILECONTENT echo "$FILECONTENT" > /etc/nginx/common.conf How do I change this so it will run successfully inside a Dockerfile? I have tried ## Common Configuration run read -r -d...

Using docker-compose volumes_from option does not work

docker,dockerfile,docker-compose
In base Dockerfile I ADD some directories from host machine to image. I want to include all directories from container running on base image to another one. So I write a simple .yml file: app: build: . links: - base volumes_from: - base base: extends: file: docker-base.yml service: base But...

Install MySQL connector/J in Docker container

java,mysql,amazon-web-services,docker,dockerfile
I'm deploying an application to a pre-configured GlassFish Docker container on Elastic Beanstalk. I need to install the MySQL connector/J library so it's accessible to GlassFish. According to the AWS documentation, "With preconfigured Docker platforms you cannot use a configuration file to customize and configure the software that your application...

Why does chown increase size of docker image?

docker,filesize,chown,dockerfile
I can't understand why the 'chown' command should increase the size of my docker image? The following Dockerfile creates an image of size 5.3MB: FROM alpine:edge RUN adduser example -D -h /example -s /bin/sh This example however creates an image of size 8.7MB: FROM alpine:edge RUN adduser example -D -h...

sudo docker build -t=“nisevi/static_web” is not working

docker,dockerfile
I'm following the steps of the "The Docker Book" and when I'm trying to build the image from a Dockerfile, I always have the same answer: [email protected] static_web:$ ll total 24 drwxrwxr-x. 2 nisevi nisevi 4096 Feb 3 09:46 ./ drwxrwxr-x. 8 nisevi nisevi 4096 Feb 2 21:28 ../ -rw-rw-r--....

wildfly docker image authentication issue

jboss,docker,wildfly,dockerfile
I've followed the instructions on the following link: WildFly Docker image in the section Extending the image However, after I make the build, when I go to the URL http://localhost:9990, I have the following message: The management interface could not be loaded. Authentication required. ...

Cannot change owner of Docker Volume directory to non-root user

docker,dockerfile
I am using Docker 1.4.1 on Ubuntu 14.04.1 LTS with Kernel 3.13.0-4. Consider the following Dockerfile FROM debian:wheezy VOLUME /var/myvol # RUN mkdir /var/myvol # copy content to volume ADD foo /var/myvol/foo # create user, and make it new owner of directory RUN useradd nonroot \ && chown -R nonroot:nonroot...

Dockerfile: RUN command with special parameters

docker,dockerfile
I want to run bash commands with special parameters like $_ inside the Dockerfile. I tried the following example but it seems to be not working. If I execute the same command in the bash directly, it works like a charm. Does anyone have an idea what I'm doing wrong?...

Where does dockerized jetty store its logs?

jetty,docker,dockerfile
I'm packaging a project into a docker jetty image and I'm trying to access the logs, but no logs. Dockerfile FROM jetty:9.2.10 MAINTAINER Me "[email protected]" ADD ./target/abc-1.0.0 /var/lib/jetty/webapps/ROOT EXPOSE 8080 Bash script to start docker image: docker pull me/abc docker stop abc docker rm abc docker run --name='abc' -d -p...

How to use custom Nginx config for official nginx Docker image?

php,nginx,docker,dockerfile,docker-compose
I have next docker-compose file: nginx: build: . ports: - "80:80" - "443:443" links: - fpm fpm: image: php:fpm ports: - "9000:9000" The Dockerfile command list is: FROM nginx ADD ./index.php /usr/share/nginx/html/ # Change Nginx config here... The Nginx server work fine and I can see default html page on...

Pacman: How to choose default choice when it asks to replace a package?

docker,pacman,dockerfile
I'm working with docker and I try to make a Dockerfile including some pacman upgrade/installation. But at some point of the upgrading process, pacman asks if I want to replace some package with an other. But in the case of a Dockerfile, an error occurs. How could I avoid that?...

Dockerfile build - possible to ignore error?

docker,dockerfile
I've got a Dockerfile. When building the image, the build fails on this error: automake: error: no 'Makefile.am' found for any configure output Error build: The command [/bin/sh -c aclocal && autoconf && automake -a] returned a non-zero code: 1 which in reality is harmless. The library builds fine, but...

Running a Docker container that accept traffic from the host

apache,centos,docker,dockerfile
I have the following config: Dockerfile FROM centos MAINTAINER Eduar Tua <[email protected]> RUN yum -y update && yum clean all RUN yum -y install httpd && yum clean all RUN echo "Apache works" >> /var/www/html/index.html EXPOSE 80 ADD run-apache.sh /run-apache.sh RUN chmod -v +x /run-apache.sh CMD ["/run-apache.sh"] The run-apache.sh script:...

My build does not include my web site directive

docker,dockerfile
I'm not sure where I went off of the rails but I am trying to create a container for my web site. First I start off with a file called 'default': server { root /var/www; index index.html; location / { try_files $uri $uri/ /index.html; } } var/www/ points to my...

docker run with ENTRYPOINT containing a variable

docker,dockerfile
I have a private git repository on github.com and I want to automate the docker build process using a Dockerfile. I naively thought the best place to have the Dockerfile is in the root folder of my repo. Example: git clone ssh://[email protected]/avilella/bioboxes_playground cd bioboxes_playground ls Dockerfile Dockerfile So the files...

Not able to access Kibana running in a Docker container on port 5601

elasticsearch,docker,dockerfile,kibana-4
I have built a docker image with the following Docker file. # gunicorn-flask FROM devdb/kibana MAINTAINER John Doe <[email protected]> ENV DEBIAN_FRONTEND noninteractive RUN apt-get update RUN apt-get install -y python python-pip python-virtualenv gunicorn # Setup flask application RUN mkdir -p /deploy/app COPY gunicorn_config.py /deploy/gunicorn_config.py COPY app /deploy/app RUN pip install...

Working on a Dockerfile in order to build a WordPress image

wordpress,debian,docker,fedora,dockerfile
I'm a newbie using Docker, and I don't understand something. If I'm using the official Dockerfile used to build the official Wordpress image, we start with: FROM php:5.6-apache Then, to install extensions and models we have to use: RUN apt-get [install or Update] My question is: Why we are using...

Run commands on create a new Docker container

docker,dockerfile
Is it possible to add instructions like RUN in Dockerfile that, instead of run on docker build command, execute when a new container is created with docker run? I think this can be useful to initialize a volume attached to host file system.

How to handle specific hostname like -h option in Dockerfile

docker,dockerfile
I'm using CentOS 7 as docker daemon host and centos:6 Docker images. I want to install some software which requires resolvable hostname as non-loopback address. If I run a docker image with -h option like docker run -i -t -h myhost centos:6 /bin/bash Then I can install the software because...

Docker will not attach to an image

nginx,docker,dockerfile,fig
I have a fig.yml file that I am using to set up my docker containers. I run this by typing ./fig up Then it outputs the following: Recreating docker_memcache_1... Recreating docker_sphinx_1... Recreating docker_percona_1... Recreating docker_php_1... Recreating docker_sa_1... Attaching to docker_memcache_1, docker_percona_1, docker_php_1 So once that is done everything is up...

How can I run my docker container with installed Nginx?

php,nginx,docker,boot2docker,dockerfile
I have docker image with Dockerfile, that successfully build with docker build . command. The Dockerfile content is: FROM ubuntu RUN apt-get update && apt-get install -y nginx php5 php5-fpm ADD . /code How can I run my docker container to see that Nginx is work? UPDATE: When I try...

ENV variable isn't added correctly to the container environment

node.js,npm,environment-variables,docker,dockerfile
Here is my Dockefile FROM ubuntu:latest MAINTAINER mazzy WORKDIR /tmp RUN apt-get update && apt-get install -y wget RUN wget http://nodejs.org/dist/v0.12.0/node-v0.12.0-linux-x64.tar.gz RUN tar xvf node-v0.12.0-linux-x64.tar.gz RUN cp -r node-v0.12.0-linux-x64 /usr/local/ WORKDIR /usr/local RUN ln -s /usr/local/node-v0.12.0-linux-x64.tar.gz /usr/local/node # FIX HERE ENV PATH /usr/local/node/bin:$PATH RUN npm install -g bower EXPOSE 8080:8080...

How to mount local volumens in docker machine

docker,dockerfile,docker-compose
I am trying to use docker-machine with docker-compose. The file docker-compose.yml has definitions as follows: web: build: . command: ./run_web.sh volumes: - .:/app ports: - "8000:8000" links: - db:db - rabbitmq:rabbit - redis:redis When running docker-compose up -d; all goes well until trying to execute the command and an error...

Dockerfile CMD `command not found`

linux,docker,dockerfile
I have the following Dockerfile: FROM nodesource/node:jessie ADD ./ /SOMEPATH RUN cd /SOMEPATH && npm install WORKDIR /SOMEPATH CMD [“bash”, “npm run lint”] When I build and run this image using this command: docker run -v $(pwd):/SOMEPATH Name_of_image I get the following error: /bin/sh: 1: [“bash”,: not found However, when...

“correct” way to manage database schemas in docker

docker,dockerfile
I'm developing an open source application consisting of a Java web application and a postgresql database. Ideally it would be deployable similar to the process detailed in the shipyard quickstart: run a data-only container run the DB container run the application container Is there a recommended time to set up...

: and := inside a bash parameter expansion [duplicate]

bash,dockerfile
This question already has an answer here: Explanation of colon operator in “: ${foo=value}” 2 answers Trying to understand a dockerfile written in bash. What is : for? : ${WORDPRESS_DB_USER:=root} And :=? I put more code from the script for reference: #!/bin/bash set -e if [ -n "$MYSQL_PORT_3306_TCP" ];...

docker's VOLUME isn't mounting host files

node.js,docker,dockerfile
I have this docker file: FROM node:0.10.38 VOLUME /opt/build WORKDIR /opt/build EXPOSE 8080 CMD node app.js However, when I got to run the container, I get the error that app.js does not exist, specifically /opt/build/app.js does not exist. I've also tried ADD and COPY to do this, both say it...

Does Dockerfile always have to be placed in the build context root?

docker,dockerfile
Let's say that I have a Django project and want to create several Dockerfiles which would use different sets of settings and system packages (not to be confused with Python libraries). For the application to run, I have to copy the full project codebase to the image. Now I've seen...

Docker: how to set up file ownership in a data-only container?

docker,dockerfile,docker-compose
I've dockerized a PHP application using a data-only container. I used this (docker-symfony) containers stack. This is a simple definition of a data-only container: FROM debian:jessie MAINTAINER Vincent Composieux <[email protected]> VOLUME /var/www/symfony Everything plays really well apart from ownership and permissions. I've noticed that when I mount volumes (my local...

Elastic Beanstalk environment variables for Docker host

docker,elastic-beanstalk,beanstalk,dockerfile,amazon-elastic-beanstalk
I have an EB env with Docker web app (rails) properly deployed. I set several EB env variables and they are properly visible in the container. Now - I'd like these EB env variables to be visible to the EC2 instance host, so that I can use them in the...

Storring and pulling meta-information of a docker image

docker,dockerfile
Is there any general way of storing meta-information about a docker image along with the image e.g. about the contained software versions? If so is there a way of fetching this information with the docker tool? Directly scrapping the docker.io index might be an option but would not be compatible...

How to install a local rpm file when building docker instance?

docker,dockerfile
I have following docker file, I want to specifically install a rpm file that is available on my disk as I am building docker instance. My invocation of rpm install looks like this. 'RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm' fails. Is there a way to install rpm file available locally to new...

Privileges in an Ubuntu Docker container after USER statement in Dockerfile

ubuntu,docker,root,dockerfile
I created a Dockerfile FROM ubuntu:latest as the parent image. Later the Dockerfile creates a new group and user without sudo privileges via RUN groupadd -r myappuser -g 433 RUN useradd -u 431 -r -g myappuser -d /opt/myapp -s /bin/false -c "my app user" myappuser Before executing the application I...

Dockerfile: $HOME is not working with ADD/COPY instructions

docker,dockerfile
Before filing a bug I would like to ask someone to confirm the weird docker build behavior I have recently faced with. Consider we have a simple Dockerfile where we're trying to copy some files into home directory of a non-root user: FROM ubuntu:utopic ENV DEBIAN_FRONTEND=noninteractive RUN sed -i.bak 's/http:\/\/archive.ubuntu.com\/ubuntu\//mirror:\/\/mirrors.ubuntu.com\/mirrors.txt\//g'...

Dockerfile and dev/test/prod environment

docker,boot2docker,dockerfile
I want to create Dockerfile that will be able to build three different images (one at the moment). Those images differs only in configuration files. I was trying: creating three different docker files (doesn't work because dockerfile needs to be named Dockerfile and be in context root finding a way...

How to correctly link php-fpm and Nginx Docker containers together?

php,nginx,docker,dockerfile,docker-compose
I try to links 2 separate containers together: nginx:latest php:fpm The problem is php scripts not work, it's probably wrong php-fpm config. The source code for test in my repository. There is a docker-compose.yml: nginx: build: . ports: - "80:80" - "443:443" volumes: - ./:/var/www/test/ links: - fpm fpm: image:...

Use Dokku Environment variables in DockerFile

docker,environment-variables,dockerfile,dokku
I'm tring to use Dokku Environment variables in DockerFile but with no success. Dokku Env is set with: dokku config:set www NR_APP=AppName In DockerFile, i would like to put this NR_APP to a file with: RUN sh -c 'echo "newrelic.appname=\"$NR_APP\"" >> /etc/php5/apache2/conf.d/newrelic.ini' But it doesn't work, the result in file...

Cannot get postgresql-9.3-postgis-2.1 on Ubuntu 14.04.1 Docker container

postgresql,docker,ubuntu-14.04,postgis,dockerfile
I tried to install postgresql-9.3-postgis-2.1 or postgresql-9.1-postgis-2.1 for a cloned app, but I can only get postgresql-9.4-postgis-2.1 on my Ubuntu docker image which is build from python:2.7 image. I looked into the image and found it's on a Ubuntu 14.04.1 image. I tries to install postgis on my Xubuntu 14.04.2...

Why does `docker images` also show the base image?

docker,dockerfile
I have a very simple dockerfile FROM makuk66/docker-solr MAINTAINER test Which I then build using docker build -t myimage/test . From what I know about Docker when I type docker images it should only show myimage/test under REPOSITORY; however this is not what happens. Instead, I see: REPOSITORY TAG IMAGE...

Docker Copy and change owner

docker,file-permissions,dockerfile
Given the following Dockerfile FROM ubuntu RUN groupadd mygroup RUN useradd -ms /bin/bash -G mygroup john MKDIR /data COPY test/ /data/test data RUN chown -R john:mygroup /data CMD /bin/bash In my test directory, which is copied I have set the file permissions to 770. If I do a su john...

How to test the container or image after docker build?

docker,dockerfile
I have the following Dockerfile ############################################################ # Purpose : Dockerize Django App to be used in AWS EC2 # Django : 1.8.1 # OS : Ubuntu 14.04 # WebServer : nginx # Database : Postgres inside RDS # Python : 2.7 # VERSION : 0.1 ############################################################ from ubuntu:14.04 maintainer Kim...

forward udp multicast from eth0 to docker0

docker,dockerfile
I have a docker container running a java application which is listening for UDP multicast packets. I am not receiving the packets inside the container, however they appear on the host machine on eth0. Is there a way for docker to automatically pick up these packets and forward them to...

Docker building an image for ELK stack

docker,dockerfile,dockerhub
I'm new to Docker Installed the docker on ubuntu 12.04.Now I want to install ELK(Elastic search,Logstash and Kibana) on Single container.How can I go with?Any suggestions.

How to properly set VOLUME and CMD instructions in Postgres Dockerfile?

postgresql,docker,dockerfile
I have a working Postgres Dockerfile that I modify and unfortunately after applying modifications Postgres container stops working as expected. I'd like to ask your for explanation of what I'm doing wrong. Working example Here's the Postgres Dockerfile that works and which I modify: # Use ubuntu image FROM ubuntu...

How does Docker name repositories?

docker,dockerfile,docker-compose
In a directory called ringer i've created a simple Dockerfile that will install some stuff and mount my app... I have never explicitly set a name. I then used a docker-compose.yml file to define web and pointed it at the Dockerfile i mentioned above. When i run docker images i...

Docker Image move to the src directory

docker,dockerfile
So , I have a project and I want to have a docker image for the project. My directory is: --Dockerfile --source So in my Dockerfile I have commands like : COPY source /source RUN cd source The image is built fine , but when I run the container the...

How can I mount a volume from a data container while preserving the owner and permissions?

ruby-on-rails,ruby,docker,dockerfile,fig
I'm using Fig and attempting to use a data volume container to share uploaded files between a Rails web server and a Resque worker running in another container. To do this the data volume container defines a /rails/public/system volume which is meant to be used to share these files. The...

Deploying a minimal flask app in docker - server connection issues

python,deployment,flask,docker,dockerfile
I have an app who's only dependency is flask, which runs fine outside docker and binds to the default port 5000. Here is the full source: from flask import Flask app = Flask(__name__) app.debug = True @app.route('/') def main(): return 'hi' if __name__ == '__main__': app.run() The problem is that...

How to get Clojure Compojure app to run headless via compiled jar within Docker container?

clojure,docker,compojure,dockerfile
Update: this question has changed since the original set of commenters left responses. Apologies for any confusion. This is my code repository https://github.com/Integralist/spurious-clojure-example you can use it as an example for what I'm working with. Note that the above repo relies on a library I've not yet published to Clojars...

Not able to clone private repo using dockerfile

github,docker,dockerfile
I am new to docker, so was trying all basic stuff. I have used following dockerfile to generate my working docker images FROM ubuntu:14.04 MAINTAINER Alok Agarwal "alok.alok.com" RUN apt-get update #Install git RUN apt-get install -y git RUN mkdir -p /root/.ssh/ ADD id_rsa /root/.ssh/id_rsa RUN touch /root/.ssh/known_hosts RUN chmod...

Error Docker deployment in Amazon EC2 - Docker container quit unexpectedly

apache,amazon-web-services,amazon-ec2,docker,dockerfile
I am trying to deploy a Dockerfile and a Dockerrun.aws.json in Amazon EC2. I am able to successfully create the Docker container but after that, the instance is crashing. I dont know why the Docker container is quitting unexpectedly or how to fix it. Log: Step 36 : RUN service...

Host verification failed error when running git clone inside dockerfile on AWS EC2 instance as host and a private git repository

git,ssh,amazon-ec2,docker,dockerfile
I am using AWS ec2 instance as private git repository. This instance is also used for running Dockerfile and docker file tries to checkout code from this private repository. My basic setup is done as per https://alvinabad.wordpress.com/2013/03/23/how-to-specify-an-ssh-key-file-with-the-git-command/ option 2. However, when i am running my docker build command: $ sudo...

Dockerfile copy keep subdirectory structure

copy,docker,dockerfile
I'm trying to copy a number of files and folders to a docker image build from my localhost. The files are like this: folder1 file1 file2 folder2 file1 file2 I'm trying to make the copy like this: COPY files/* /files/ However, all files are placed in /files/ is there a...

Creating a table in single user mode in postgres

postgresql,docker,dockerfile
Im trying to create a Dockerfile from the postgres image. The repo says that initialization should be handled by placing a shell script in /docker-entrypoint-initdb.d/. I put the following script based on an example I found online: #!/bin/bash echo "******CREATING DOCKER DATABASE******" gosu postgres postgres --single <<- EOSQL CREATE DATABASE...

Run Grunt / Gulp inside Docker container or outside?

node.js,gruntjs,docker,gulp,dockerfile
I'm trying to identify a good practice for the build process of a nodejs app using grunt/gulp to be deployed inside a docker container. I'm pretty happy with the following sequence: build using grunt (or gulp) outside container add ./dist folder to container run npm install (with --production flag) inside...

Simple docker deployment tactics

bash,docker,dockerfile
Hey guys so I've spend the past few days really digging into Docker and I've learned a ton. I'm getting to the point where I'd like to deploy to a digitalocean droplet but I'm starting to wonder about the strategy of building/deploying an image. I have a perfect Dev setup...