You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a folder with a meaningful name as this will be your container name
create a file named as docker-composer.yaml
paste following file
version: '3' //version is important and defined by docker not custom
services:
# Database
db:
image: mysql:latest #latest is the version tag for the docker image
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
networks:
- my-net //as they will share same network, pass any custom network name
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
networks:
- my-net //pass same name as we declared for mysql
networks:
my-net:
volumes:
db_data:
for running :
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes