This framework was developerd from completing the Object Oriented PHP & MVC course created by Brad Traversy. All credits go to Brad Traversy.
Domain mapping for this project is set to share-posts
.
Run docker-compose build
in the root dir. Once the container is built, run docker-compose up
.
docker run
-> creates a container from an image (if not present locally it pulls from remote)docker stop <container_id>
-> stops the containerdocker start <container_id>
-> starts the container of an existing containerdocker ps
-> Check all containers running- `docker ps -a`` -> Check all containers running and not running
docker rm <container_id>
-> removes the containerdocker rmi <image_id>
-> removes the image
docker logs <container_id>
-> logs of the containerdocker exec -it <container_id> /bin/bash
-> enter bash in the container You can replace container_id with custom names...
-d
-> detach mode which means you can run the container in the background-p <localport>:<containerport>
-> port mapping to allow access to the container-f
-> force remove the container if it exists--name <name>
-> name of the container
<image>:<version>
The idea of docker compose is to create a docker-compose.yml file and then run it. Inside the docker-compose.yml file you can define the images, ports, volumes, and other parameters. It creates a docker network and then creates the containers. this way you can have multiple containers running in the same network.
docker-compose -f <filename> up
-> starts the containersdocker-compose down
-> stops the containersdocker-compose build
-> builds the containersdocker-compose run <container_name>
-> runs the containerdocker-compose logs <container_name>
-> logs of the container
Remove all docker containers in order to rebuild by running
docker-compose down
then to clean up containers
docker container prune
then to clean up images
docker image prune -a
then to clean up volumes (Getting rid of the volumes will lose data. eg local databases. Elastic Search indexes If you need that backup first.)
docker volume prune