Tag: php

PHP docker best way. Build application inside or outside docker? [closed]

I have php application with manu dependencies like framework, libraries, etc. All of this dependencies is resolved by composer. I have seen 2 ways to dockerize apllication The 1st way (building outsude docker) make composer install on host machine and after it copy full project directory to container. The 2nd way (building inside continer) add […]

Symfony Process pgrep fails

Here’s my code(Laravel) $process= new Symfony\Component\Process\Process(“pgrep java”); try { $process->mustRun(); } catch (ProcessFailedException $e) { return $e->getMessage(); } return $process->getOutput(); it fails. When I try pgrep –help it succeeds. I tried this when java is running and not. This is the error: I also use Docker by the way, and I’ve already tried: docker-compose exec […]

docker mysql connection via php

I have the following settings in docker-compose.yml mysql: image: mysql:latest ports: – “3306” volumes: – /var/lib/mysql environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: project MYSQL_USER: project MYSQL_PASSWORD: project In my index.php, I want to connect to my database container, however, I’m not sure what to type in host=localhost, the following code doesn’t work <?php $db = new PDO(‘mysql:host=localhost;dbname=project;charset=utf8mb4’, […]

ERROR: mkdir with chown not working in Dockerfile (nginx with php-fpm)

For version control and security I want to merge two Dockerfiles into one and then create a directory for .sock => running rmdir and chown. Without rmdir and chown, I can perfectly build the docker if run over port:9000. As soon as I try setting up the directory for .sock, in the dockerfile, the docker […]

How to launch existing WordPress app image with Docker not at default 80 port?

may be somebody know how to resolve my issue? If I use my existing app with wp-content and existing db, every time I’ve get redirected to the localhost:80 port. How to launch it at another port, maybe 8000 for example? I have a WordPress app Dockerfile with next lines: FROM wordpress:latest COPY ./src /var/www/html ENV […]

Docker + PHP – ERROR: Couldn't connect to Docker daemon?

I’m following this guide to set up a PHP development environment with Docker. I have created a folder on my desktop docker-php and added a docker-compose.yml file into it, with this content: nginx: image: nginx:latest ports: – 80:80 On my terminal: $ cd /home/my-username/Desktop/docker-php/ $ docker-compose up -d I get this error: ERROR: Couldn’t connect […]

starting docker container with host mount to container

I am beginner and just started using docker, before posting here I google a lot but a lot of mixed confusing result. I started docker with this command docker run -itd –name dockWeb2 -v /var/www/wordpress/ -p 80:80 atozchevara/rpi-apache-php5 hoping I would be able to directly mount wordpress installation onto container , as by default it […]

Symfony can't connect to MySQL Docker container

I have three Docker containers running on Mac OS sierra, namely web, mysql and mongo, and have linked both mongo and mysql into web, which is essentially a Ubuntu Xenail base, with Apache and PHP added. I am currently mounting my local Symfony project into the web container, and that seems to be working fine, […]

Docker – Ubuntu – Nginx – MariaDB – Connection refused

Im trying to setup a docker container on OSX with Docker – Ubuntu – Nginx – MariaDB to run a Laravel App My docker settings are: version: “2” services: nginx: build: context: ./nginx ports: – “8080:80” volumes: – ./app:/var/app fpm: build: context: ./fpm volumes: – ./app:/var/app expose: – “9000” environment: – “DB_HOST=db” – “DB_DATABASE=laravel_db” db: […]

LEMP Kubernetes

Let’s say we don’t want to over complicate the example and we’ve decided to use external storage for database. Also, code, config files etc are part of docker images. My question is, based on experience, good practices and ease of use. What’s the strategy you guys are using for deploying nginx, php-fpm stack? Three options […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.