docker ps
- list running docker containersdocker ps -a
- list all containers (running and non)docker rm <CONTAINER_ID>
- Removes a containerdocker rmi
- Can remove multiple images, IDs separated by a space- Example:
docker rmi 48b5124b2768 8672b4215b84
- Example:
- DOCKERFILE:
- Create directory
touch Dockerfile docker-compose.yml index.php
- Update Dockerfile
- Update index.php
docker build -t <APP_NAME> .
docker run -p 8080:80 -d --name=<IMG_NAME> <APP_NAME>
docker ps
to show running container- Shut down cotainer:
docker stop docker-php
- RM the container:
docker rm docker-php
- DOCKER COMPOSE YML
- Compose is a tool for defining and running multi-container Docker applications
- PORT: <host_- port>:<container_port>
docker-compose up -d
: Run it in the backgrounddocker exec -it <IMG_ID> bash
if you want to run bash in the container
- Set up Lumen and create new project
lumen new <PROJECT_NAME>
touch Dockerfile docker-compose.yml
mkdir -p .docker/{php,apache}
- create .docker directory with php and apache directoriestouch .docker/php/php.ini
touch .docker/apache/vhost.conf
- Set up Dockerfile, php.ini, vhost and docker-compose.yml.
docker-compose up --build
- Add mysql module to Dockerfile
docker-compose stop
docker-compose build
- update docker-compose.yml with mariadb stuff
- Set up
.env
- bash inside container:
docker exec -it <CONTAINER_ID> bash
cd /srv/app
php artisan migrate
- Add opcache
- enable apache modules
- Dev environment, XDebug, etc.