76 votes
Accepted

Configuring Docker to not use the 172.17.0.0 range

It is possible to redefine default range. $ docker -v Docker version 18.06.0-ce, build 0ffa825 Edit or create config file for docker daemon: # nano /etc/docker/daemon.json Add lines: { "default-...
user avatar
  • 876
42 votes
Accepted

How is Docker Compose version 2 "volumes" syntax supposed to look?

Purpose of the volumes key It is there to create named volumes. If you do not use it, then you will find yourself with a bunch of hashed values for your volumes. Example: $ docker volume ls DRIVER ...
user avatar
  • 1,251
40 votes

Configuring Docker to not use the 172.17.0.0 range

There are three places docker will generate network subnets. The default bridge User generated bridge networks Swarm mode generated overlay networks For the default bridge (called "bridge"), you can ...
user avatar
  • 5,139
37 votes
Accepted

How does "restart: always" policy work in docker-compose?

When you use docker kill, this is the expected behavior as Docker does not restart the container: "If you manually stop a container, its restart policy is ignored until the Docker daemon restarts or ...
user avatar
  • 1,171
35 votes
Accepted

Check is container/service running with docker-compose

docker-compose ps -q <service_name> will display the container ID no matter it's running or not, as long as it was created. docker ps shows only those that are actually running. Let's combine ...
user avatar
30 votes
Accepted

Can not access mysql docker

You can pass an extra environment variable when starting the MySQL container MYSQL_ROOT_HOST=<ip> this will create a root user with permission to login from given IP address. In case where you ...
user avatar
  • 416
20 votes

Is there any way to run Postfix in foreground?

Starting with Postfix version 3.3, you can also use postfix start-fg, which according to the documentation: Like start, but keep the master(8) daemon running in the fore-ground It makes things ...
user avatar
20 votes

Docker turn anonymous volume into named volume

To summarize the workaround: docker volume create --name <new_volume> docker run --rm -it -v <old_volume>:/from:ro -v <new_volume>:/to alpine \ ash -c "cd /from ; cp -av . /...
user avatar
  • 306
18 votes
Accepted

Force Ansible to log off to refresh user groups

I am not certain if it will work for you, but I suggest you try adding a reset_connection. - name: reset ssh connection meta: reset_connection There is an example here. https://docs.ansible.com/...
user avatar
  • 128k
17 votes
Accepted

docker-compose for nginx and nodejs server

You use the container's name as you defined it in docker-compose.yml. Docker provides the IP addresses for the named containers via DNS within each container, and updates them if the containers are ...
user avatar
16 votes
Accepted

How and where to configure pm.max_children for php-fpm with Docker?

I may be wrong, but assuming you're using the official PHP images those pm settings should be placed inside the /usr/local/etc/php-fpm.d/ directory inside a file with conf extension. According to PHP ...
user avatar
  • 1,171
15 votes

How is Docker Compose version 2 "volumes" syntax supposed to look?

The way I understand it, you can use the global volumes: section to define a volume name make an named volume available under a different volume name specify a driver and driver options for a named ...
user avatar
  • 251
15 votes

Check is container/service running with docker-compose

As for version 1.7.1, there are no such commands built-in. Instead, the exec can be used in similar way. When you run it for the service which has some containers up it will run ok: ~/apperture-...
user avatar
13 votes

Check is container/service running with docker-compose

To see all services running: docker-compose ps --services --filter "status=running" To see if your-service is running: docker-compose ps --services --filter "status=running" | grep <your-service&...
user avatar
  • 131
13 votes
Accepted

Expose a Unix socket to the host system from inside from a Docker container

You can communicate the host machine or even two containers using the same socket. In the general case of two containers, you should start the two dockers from the host machine sharing a volume that ...
user avatar
11 votes

Where is docker volume stored in the host computer for docker-compose?

The volumes will normally be stored somewhere in /var/lib/docker/volumes/ To find out more, try the following commands docker volume ls docker volume inspect <volume identifier> See also: ...
user avatar
  • 1,409
10 votes

Configure php-fpm to access environment variables in docker

This is a PHP-FPM prank. Setup the clear_env = no on /etc/php/7.2/fpm/pool.d/www.conf, so; On Dockerfile start de php-fpm with init.d, not use service. Ex: CMD /etc/init.d/php7.2-fpm start &&...
user avatar
9 votes
Accepted

nginx and php-fpm: "Primary script unknown" while reading response header from upstream

I finally solved it! Turns out that the root location had to match the location of the files on the php-fpm container as that's what was being past through via: fastcgi_param SCRIPT_FILENAME $...
user avatar
8 votes

Is there any way to run Postfix in foreground?

Since Postfix 3.3, docker is natively supported. Simply build and run this Dockerfile : FROM alpine:3 RUN apk add --no-cache postfix postfix-pcre RUN echo "maillog_file = /dev/stdout" >&...
user avatar
8 votes
Accepted

Docker turn anonymous volume into named volume

You cannot currently rename existing volumes. (This is true whether they were previously named or were unnamed and had their names auto-generated.) You can see this issue for more information on ...
user avatar
  • 3,053
7 votes
Accepted

docker-compose exec composer as user

After doing some research I just realized that the php7-fpm image I am using has some users built-in like www-data (compatible with my actual box configuration). So I just had to use the flag "--user ...
user avatar
  • 231
7 votes
Accepted

Mysql needs to be run as root (docker)

/usr/libexec/mysqld --user=root should work. Described at online manual page
user avatar
  • 6,240
7 votes

Docker Compose returns error "networks have overlapping IPv4"

From the error you’ve shown here, it looks to me that docker is trying to create a network with bridge driver named br-791b388ece09, which then complains has an overlapping IP subnet with the bridge ...
user avatar
7 votes

Docker + Nginx + PHP-FPM error: [emerg] 1#1: host not found in upstream

nginx fails to resolve the hostname php-fpm and therefore refuses to start. There is a simple workaround which - in this case - results in a 502 - Bad Gateway until nginx is able to resolve the ...
user avatar
7 votes
Accepted

Docker - PHP 7.2 FPM Alpine - Imagick

The files you are missing are in the imagemagick package, which you also need to apk add explicitly. The dependencies for imagemagick-dev do not pull it in.
user avatar
7 votes
Accepted

How to prevent docker-compose appending hashes to created container names?

This is the new behavior from docker-compose and mirrors the behavior of swarm mode. It doesn't impact the ability to connect the containers via the network at all since there are DNS aliases for the ...
user avatar
  • 5,139
7 votes

What are proper iptables Rules for Docker Host?

I can't access the internet from within containers (if I put iptables: false in Docker's daemon.json config file) Docker relies on iptables to configure its networking. This includes NAT rules to ...
user avatar
  • 5,139
7 votes

CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team

This is the issue of the latest version(0.17.0) of pyrsistent. You should install the past version. pip uninstall pyrsistent pip install pyrsistent==0.16.0
user avatar
  • 71
6 votes

Check is container/service running with docker-compose

You can run: docker-compose ps -q service-name And you will get the id of the container if service-name is running. Something like: 18a04e61240d8ffaf4dc3f021effe9e951572ef0cb31da7ce6118f681f585c7f ...
user avatar
6 votes

How to prevent docker containers auto-start at daemon start in Windows?

You can easily achieve this by using the following command: docker update --restart=no my-container Where my-container should be every container you don't want to be started when your Host (In ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible