In order to give our non-root user access to the Docker management commands, we need to create a docker group (it may already be created for you), and then add your primary user to that group.
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
By running this command, we ask Docker Compose to execute Bash on the PHP container:
docker-compose exec php bash
This command aggregates the logs of every container, which is extremely useful for debugging:
docker-compose logs -f
It is also possible to display the information of a specific container simply by appending the name of the service:
docker-compose logs -f nginx
docker-compose up -d
NB : (if build
and not image
for a service) Image for service php was built because it did not already exist. To rebuild this image you must use docker-compose build
or docker-compose up --build
.