We use Docker in order to be able to develop in a local environment. We've chosen it because it's the only tool that allows to build an environment with different PHP versions without consuming too much resources.
- Clone this repo
git clone git@github.com:juanBL/makespace_castellar_docker.git devops/
- Install Docker. Note for MacOS: Do not be confused with the deprecated "Docker toolbox" package. It was a previous approach with less performance than the "Docker for Mac".
- Start your "Docker" app
- Move to the docker directory:
cd devops/docker
- Copy the
volume_mappings.yml.dist
tovolume_mappings.yml
and replace the%YOUR_PROJECTS_PATH%
string with your own path - Create the mapped folders in case you don't already have them (for instance:
mkdir %YOUR_PROJECTS_PATH%/makespace_castellar_database
. Check section in order to setting up all repositories) - Move to the devops directory:
cd ..
- Build containers:
docker-compose build
- Start containers in detached mode::
docker-compose up -d
- Stop containers:
docker-compose stop
- Start containers:
docker-compose start
- Stop containers:
docker-compose stop
- Build the containers:
docker-compose build
(if you don't want to use cache, remember that you have the--no-cache
flag available for this command) - Create and start containers in detached mode:
docker-compose up -d
- List running containers:
docker-compose ps
(if you want to show all containers, remember that you have the-a
flag available for this command) - Open an interactive bash terminal inside a container:
docker-compose exec <service_name> bash
- List running containers:
docker ps
- Show container logs:
docker-compose logs makespace_castellar_database
- Start a container from a specific
Dockerfile
:- Move to the
Dockerfile
directory - Build:
docker-compose build <service_name>" .
- Run:
docker-compose up -d <service_name>
- Move to the
- List all Docker networks:
docker network ls
- Inspect the details of a specific network:
docker network inspect devops_main
- In order to check which is the IP of your host from the point of view of a container:
docker network inspect devops_main |grep Gateway
- Stop and delete all containers:
docker-compose down
- Delete all images:
docker rmi $(docker images -aq)
- Remove all data from stopped containers:
docker system prune -a
- Remove all networks:
docker network prune