Sulu-Docker
Development environment for the Sulu content management platform built with Docker Compose.
Docker is a great tool for trying new technologies effortlessly. Unfortunately, there are still significant filesystem performance issues when using bind mounts on some systems.
If you are experiencing bad performance, we recommend to use dockerized services (MySQL, Elasticsearch) in combination with the Symfony Local Web Server. For example, the Sulu Demo repository includes such a setup.
URLs
- Sulu-Website:
PROJECT_DOMAIN:PORT_NGINX(default:sulu.localhost:10080) - Sulu-Admin:
PROJECT_DOMAIN:PORT_NGINX/admin(default:sulu.localhost:10080/admin) - MySQL:
PROJECT_DOMAIN:PORT_MYSQL(default:sulu.localhost:13306) - Elasticsearch:
PROJECT_DOMAIN:PORT_ELASTICSEARCH(default:sulu.localhost:19200)
Install Environment
git clone https://github.com/sulu/sulu-docker && cd sulu-dockerThe .env file contains several environment variables that are used to throughout the environment.
This allows to configure the project path, database settings, public ports of the services and the domain name.
To access your project via the configured domain, you need to add it to your /etc/hosts file:
127.0.0.1 sulu.localhost (value of your PROJECT_DOMAIN)
Startup Containers
docker-compose upYou can also startup the containers in the background by executing:
docker-compose startCreate Sulu Project
# Start bash inside of the php container
docker-compose exec php bash
# Create a new sulu project with composer
composer create-project sulu/skeleton /var/www/html
# Set the correct database url in the `.env.local` file
echo "DATABASE_URL=mysql://$MYSQL_USER:$MYSQL_PASSWORD@mysql:3306/$MYSQL_DATABASE" >> .env.local
# Initialize sulu project
bin/adminconsole sulu:build dev --destroyAfter completing these steps the services are accessible via the URLs listed above.
Update Container Configuration
When changing configuration inside of the docker folder, the environment must be rebuilt and restarted:
docker-compose down
docker-compose build
docker-compose up