Setup proper file permissions of wp-content folder so that you can use your favorite editor
There is a default USER environment variable which hold the user name of current logged-in user. We will use these variables in our docker-compose.yml file and create two environment variables to be used inside wordpress container.
Find out your user name and id by
id YOUR_USERNAME
and copy and paste the the value in .env-sample
LOCAL_USER_ID=sample_id
LOCAL_USER_NAME=sample_user
- Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But envsubst may be used as a workaround if you need to generate your nginx configuration dynamically before nginx starts.
- More Links and how to use envsubst
- (For ubuntu) install homebrew to be able to install [mkcert]
- install mkcert for creating the SSL cert
- Create SSL cert
cd cli
chmod +x create-cert.sh
./create-cert.sh
- Edit the .env-sample file with custom value, change its name to .env
- change the server_name in nginx.conf file to your custom domain
docker-compose build
docker-compose up -d
- after containers up run
mkcert -install
docker-compose build --no-cache
docker-compose up -d db
docker-compose up -d wp
docker-compose up -d nginx
docker-compose up -d php-myadmin
docker container logs CONTAINER_NAME
- Thanks to Rajinder Deol for scripts of setting up proper file permissions
- Rajinder's post
- More about Permission
- Thanks to urre for scripts to create the SSL cert
- Local WordPress Development with Docker and Docker Compose
- Mkcert valid https certificates for loclhost