Menu
  • HOME
  • TAGS

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

php,nginx,docker,dockerfile,docker-compose

You can create a very simple docker image containing your custom nginx configuration and mount this volume in the container that uses original nginx image. There are just a few steps to follow. 1. Create your custom nginx config image project mkdir -p nginxcustom/conf cd nginxcustom touch Dockerfile touch conf/custom.conf...

Docker recreates directories on host after reboot

directory,docker,reboot,docker-compose,recreate

Those containers might still exists. What does the docker ps -a command shows? If you can still see your gitlab related containers, remove them with docker rm -f <container name>, then delete the directories and reboot to check if they appear again. If you still have your docker-compose.yml file, then...

docker run local script without host volumes

database,shell,docker,docker-compose

The solutions I have found are: docker run tomdavidson/initdb bash -c "`cat initdb.sh`" and Set an ENV VAR equal to your script and set up your Docker image to run the script (of course one can ADD/COPY and use host volumes but that is not this question), for example: docker...

Docker-compose and pdb

python,docker,pdb,docker-compose

Try running your web container with the --service-ports option: docker-compose run --service-ports web

How do I uninstall docker-compose?

osx,docker,docker-compose

Since it is installed to /usr/local/bin/docker-compose, I would run the following from the command line (*nix systems) to remove it: rm /usr/local/bin/docker-compose If you get a permission denied error then you will need to prepend sudo: sudo rm /usr/local/bin/docker-compose To verify that it was successful just run the command: docker-compose...

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

php,nginx,docker,dockerfile,docker-compose

Don't hardcode ip of containers in nginx config, docker link adds the hostname of the linked machine to the hosts file of the container and you should be able to ping by hostname. Every time a docker container spins up from an image (even stop/start-ing an existing container) the containers...

docker-compose up not adding code to remote container

docker,docker-compose

What I'm really looking for is found in this Using Compose in production doc. By Extending services in Compose you're able to develop interactively with a local VM and deploy to a remote VM without having to change the Dockerfile or docker-compose.yml.

no django app created when following the docker-compose tutorial

python,django,docker,docker-compose,docker-machine

You need to set up a dockerfile so that when you do a docker build, it copies your local code onto the container. To get started, you will need to copy the files from container to local. Look here for that. Or just overwrite the directory with your own django...

Using docker-compose (formerly fig) to link a cron image

ruby-on-rails,cron,docker,fig,docker-compose

What actually would you like to do with your containers? If you need to access some objects from container's file system, you should just mount the volume to the ancillary container (consider --volumes-from option). Any SSH interaction between containers is considered as a bad practice (at least since docker 1.3,...

What is a good way to add python dependencies to a Docker container?

python,django,docker,pip,docker-compose

You could mount requirements.txt as a volume when using docker run (untested, but you get the gist): docker run container:tag -v /code/requirements.txt ./requirements.txt Then you could bundle a script with your container which will run pip install -r requirements.txt before starting your application, and use that as your ENTRYPOINT. I...

Using docker-compose volumes_from option does not work

docker,dockerfile,docker-compose

Sorry for so stupid question. I've forgot to include VOLUME base instruction to base image Dockerfile, so other containers can't use this mount point...

Docker-compose , anyway to specify a redis.conf file?

redis,docker,docker-compose

Yes. Just mount your redis.conf over the default with a volume: redis: image: redis volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "6379" Alternatively, create a new image based on the redis image with your conf file copied in. Full instructions are at: https://registry.hub.docker.com/_/redis/ However, the redis image does bind to 0.0.0.0 by...

Build multiple images from multiple dockerfile

docker,docker-compose

Just use the -f argument to docker build to specify the name of the Dockerfile to use: $ docker build -t <image_name> -f Dockerfile_app1 . ... Or in Compose you can use the dockerfile key from version 1.3 onwards: app1: build: . dockerfile: Dockerfile_app1 ports: - "80:80" app2: build: ....

How stop containers run with `docker-compose run`

docker,docker-compose

just stop those test containers with the docker stop command instead of using docker-compose. docker-compose shines when it comes to start together many containers, but using docker-compose to start containers does not prevent you from using the docker command to do whatever you need to do with individual containers. docker...

docker-compose: using multiple Dockerfiles for multiple services

docker,fig,docker-compose

This is not possible due to the way Docker handles build contexts. You will have to use and place a Dockerfile in each directory that becomes part of the Docker build context for that service. See: Dockerfile You will in fact require a docker-compose.yml that looks like: service1: build: service1...

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

docker,dockerfile,docker-compose

Use the same image you use for running the application to make your data container. For example, if you want to make a postgresql database, use the postgres image for your data container: $ docker run --name dc postgres echo "Data Container" This command created the data container and exited...

docker-compose error - unable to read file

django,docker,docker-compose

The docker build executes in a container separate from your host. The container has its own filesystem and is unaware of files on the host system. You may copy files to the container by using COPY /path/on/host /path/on/container in the Dockerfile Currently pip needs files, but they have not been...

Using Docker-Compose, how to execute multiple commands

docker,yaml,docker-compose

Figured it out, use bash -c example: command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" ...

Passing bash code through the environment (for docker-compose)

shell,docker,sh,docker-compose

This answer is bad practice. Please consider an approach which doesn't involve eval instead. wait_command='[ $(curl --write-out %{http_code} --silent --output /dev/null http://elastic:9200/_cat/health?h=st) = 200 ]' is_ready() { eval "$wait_command" } Differences from original code: Actually includes test command synonym [ inside of the environment variable being evaluated (prior version was...

Print timestamps in Docker Compose logs

docker,docker-compose

Until Compose catches up with the docker client and adds the -t argument, I think you're out of luck. However, you still have a few choices: Starting with Docker 1.6, you can use the syslog driver which will log to your hosts syslog driver (but commands such as docker logs...

How do I keep IPs in a dockerized Consul cluster on a single node after restart

docker,docker-compose,consul

I have had the same problem until I have read that there is a ARP table caching problem when you restart a containerized consul node. As far as I know, there are 2 workaround: Run your container using --net=host Clear ARP table before you restart your container: docker run --net=host...

docker and jwilder/nginx-proxy http/https issue

https,docker,reverse-proxy,boot2docker,docker-compose

I think your configuration should be correct, but it seems that this is the intended behaviour of jwilder/nginx-proxy. See these lines in the file nginx.tmpl: https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl#L89-L94 It seems that if a certificate is found, you will always be redirected to https. EDIT: I found the confirmation in the documentation The...

Running 'docker-compose up' raises “No module named fnctl” error on Windows

windows,python-2.7,docker,boot2docker,docker-compose

You can run docker compose on boot2docker Windows. You can install docker compose in a container directly in boot2docker and use it that way. See "How to install docker-compose on Windows and issue 1085....

Multiple process execution and Ordering issues in docker-compose

bash,process,zookeeper,race-condition,docker-compose

The way I solved my problem was to use shared volumes between containers, where the first process creates a new file on this volume after it has done it's job and the other process runs a loop to check if this file has been created. Once the 2nd process detects...

docker-compose: postgres data not persisting

postgresql,sqlalchemy,docker,boot2docker,docker-compose

The problem is that Compose creates a new version of the postgresdbdata container each time it restarts, so the old container and its data gets lost. A secondary issue is that your data container shouldn't actually be running; data containers are really just a namespace for a volume that can...

How to see a linked container as localhost?

docker,docker-compose

There seems to be some confusion here. It looks like you are trying to log into the web container and access the api container using the localhost address? This isn't going to work. The best solution is just to use the link you've declared; within the web container you should...

docker-compose: accessing postgres' shell (psql)

postgresql,docker,docker-compose

You're trying to connect the Postgresdb container from itself, but container is not aware about the alias postgresdb that you have set up inside your main container. Consider the following example: $ docker run -it --rm ubuntu hostname --fqdn 817450b29b34 Now you see that Postgresdb doesn't know how to resolve...

docker-compose does not start postgres image

django,postgresql,docker,docker-compose

It looks like your application is looking for the Database on localhost. It should be looking for the db at the host db (the host name will have been added to /etc/hosts by the link argument).

Different env-file but same yml with Docker Compose?

docker,docker-compose

This is a much requested feature of Docker Compose. Unfortunately, the answer at the moment is that you can't. I'd recommend subscribing to these GitHub issues to get a better idea when and if this feature gets implemented: https://github.com/docker/compose/issues/495 https://github.com/docker/compose/pull/76 https://github.com/docker/compose/pull/845 Issue #495 is actually the most commented in their...

Docker-compose running container

package,docker,zookeeper,docker-compose

I solved this issue by just restarting by boot2docker. The problem was with the DNS where i was switching between the connections between two places and luckily just restarting the boot2docker resolved this issue.

Docker command with env var prepended (local env var)

python,shell,docker,environment-variables,docker-compose

Setting environment variable might be set differently, as illustrated in tests/fixtures/extends/common.yml web: image: busybox command: /bin/true environment: - FOO=1 - BAR=1 In your case: web: command: python manage.py runserver environment: - INSTASONG_ENV=production ...

How do I make a Docker container start automatically on system boot?

docker,docker-compose

Yes, docker has restart policies such as docker run --restart=always that will handle this. This is also available in the compose.yml config file as restart: always.

local files missing from docker-machine container

django,postgresql,docker,docker-compose,docker-machine

Docker volumes mount files from the host into the container. So in this case, you've mounted the current directory of whatever host docker-machine is pointing to into the container. Unless you have some funky VM crossmounting going on (like boot2docker does), this isn't going to match the directories on the...

How to mount local volumens in docker machine

docker,dockerfile,docker-compose

Also ran into this issue and it looks like local volumes are not mounted when using docker-machine. A hack solution is to get the current working directory of the docker-machine instance docker-machine ssh <name> pwd use a command line tool like rsync to copy folder to remote system rsync -avzhe...

How to setup nginx as reverse proxy for Ruby application (all running inside Docker)

ruby,nginx,docker,docker-compose

In your gist, you are using image as a key instead of build, so docker-compose is trying to pull the image from the registry, which is failing. Since you are building these images locally, the syntax for your docker-compose.yml file should look like this: frontend: build: front-end/ ports: - "8080:5000"...

How does Docker name repositories?

docker,dockerfile,docker-compose

From the docs: COMPOSE_PROJECT_NAME Sets the project name, which is prepended to the name of every container started by Compose. Defaults to the basename of the current working directory. BTW, this is not docker, but docker-compose that is deciding on the name. To change it, set the COMPOSE_PROJECT_NAME before running...

docker-compose generating duplicate entries in /etc/hosts

docker,docker-compose

They are coming from pre-1.0 docker-compose, where multiple db instances where named after _1, _2 pattern. PR 364 introduced link name (by default, the name of the linked service) as the hostname to connect to, instead of using environment variable. There are still aliases with _x added for each container...

Docker Compose with one Terminating Container

docker,exit,exit-code,docker-compose,fig

My workaround for now is to keep the pre-loading container running by adding tail -f /dev/null to the end of the entrypoint script. This keeps the process running, while nothing actual happens.