41

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 VOLUME NAME local f004b95d8a3ae11e9b871074e9415e24d536742abfe86b32ffc867f7b7063e55 local ...


34

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-address-pools": [ {"base":"10.10.0.0/16","size":24} ] } Restart dockerd: # service docker restart Check the result: $ docker network create foo $ ...


22

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 the container is manually restarted. This is another attempt to prevent a restart loop" (reference) If you use docker stop or docker kill, you're manually ...


17

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 these two commands: if [ -z `docker ps -q --no-trunc | grep $(docker-compose ps -q <service_name>)` ]; then echo "No, it's not running." else echo "...


16

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 specify BIP (I believe that's Bridge IP; make sure it's a host IP, not a network IP) in the daemon.json file. And for user generated bridge networks you can ...


13

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 volume Volumes in the global section will be auto-created unless you specify external: true. You will still need to tell each service in its volumes: section ...


13

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 much easier!


13

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 updated. In this case, you called it server, so that is what you would use. proxy_pass http://server:8000; Documentation: Networking in Compose


12

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-science $ docker-compose exec chell echo 'Still alive!' Still alive! ~/apperture-science $ echo $? 0 But when you run it for the service which has no running ...


11

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 want to allow login from any IP you can specify MYSQL_ROOT_HOST=%. This will work only for a newly created containers. When spinning new container: docker run ...


6

/usr/libexec/mysqld --user=root should work. Described at online manual page


6

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 docs, those settings are FPM related and although they use php.ini syntax, they should be placed in a different file, so I believe that your pm settings are ...


6

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 br-a675c47764eb. So first check your available networks using: $ docker network ls If you see the bridge with the ID a675c47764eb, make sure this is deleted ...


6

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 service name that are always included, in your case app and db. There's no need for the full container name to connect to a replica of a service using round-...


6

It's fixed in version 1.23.2: Reverted a 1.23.0 change that appended random strings to container names created by docker-compose up, causing addressability issues. Note: Containers created by docker-compose run will continue to use randomly generated names to avoid collisions during parallel runs.


5

You can configure docker daemon on your Docker host to listen on TCP port rather than the /var/run/docker.sock socket. You just need to run dockerd on that host with one extra parameter: -H tcp://<IP>:<PORT> See the documentation for details. Once you have that, you can tell docker-compose on your Jenkins node to connect to remote daemon over ...


5

I think what you're trying to do is roughly the same as seen here. In short: it's currently not possible to create a named volume that refers to a mount point on the host. You can create a named volume to share data between containers, but the data will only exist in the volume itself, and disappear when you delete the volume. Mounting named volumes has ...


5

Check out Version 2 for example, also Volume configuration reference: My example: (Version 1) $ tail -4 docker-compose.yml volumes: - ./etc/nginx/conf.d:/etc/nginx/conf.d:ro - ./var/log/nginx:/var/log/nginx:rw - ./var/www/html:/var/www/html:rw $


5

Securing a docker engine requires paying attention to many different aspects, and defense in depth is always about layers of security. One of the requirements you have listed, restricting what users can command the docker engine to do, is probably one of the most important, as, as of now, the docker engine does not implement an authorisation control. Your ...


5

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 www-data" along with the command to use the composer inside the container and keep the files with the right permissions. docker-compose exec --user www-data ...


5

Docker compose has the logging keyword: source logging: driver: syslog options: syslog-address: "tcp://192.168.0.42:123" So if you know where to go from there, go for it. If not, I can advice you to look into the gelf logging driver for docker and the logstash gelf input plugin If you would for instance use this basic ELK-stack-in-containers ...


5

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 If the service is not running the output is empty, so if you want to use this in a script you can do something like: IS_RUNNING=`docker-compose ps -q service-...


5

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: https://www.linux.com/learn/docker-volumes-and-networks-compose


5

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 should be created in the host machine. docker run --name "containerA" -v /var/run/common_socket_dir:/var/run/common_socket_dir... docker run --name "containerB"...


5

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.


4

List all network $ip a If you see the bridge with br-a675c47764eb and its status is down,delete it $brctl delbr br-a675c47764eb Then restart docker $service docker restart Run docker-compose Again


4

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/ansible/2.6/modules/meta_module.html You may want to add this as a handler, and notify it from your user/group modification tasks. Then also add a meta: ...


3

With the latest docker-compose it wont work on links, you need to use docker networks. And actually you can omit the fluentd-address because fluentd log driver autodiscover for anyting that listening on 24224 in that case version: "2" services: fluentd: image: fluent/fluentd:v0.14.8 container_name: fluentd networks: - nw-01 nginx: ...


3

I used this configuration in my NGINX config where appsrv is the name of the docker-compose.yml service for the fastcgi image server { #listen 80 default_server; listen 80; #server_name xxxxxxxxx.com; index index.php index.html; root /var/www/html; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index ...


3

You need to add php.ini file: Run temporary php container docker run -d --name php-tmp php:5-fpm Copy php archive docker cp php-tmp:/usr/src/php.tar.xz . Extract php.ini-development or php.ini-production file to config dir. Example: compose_root/php/php.ini-development Add volume with php.ini in php container volumes: .root:/var/www/html:ro ./php/...


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