version: "3.8"
services:
ubuntu:
image: ubuntu
container_name: ubuntu
extra_hosts:
- "host.docker.internal:host-gateway"
command: sleep infinity
services:
wp:
image: wordpress:latest # https://hub.docker.com/_/wordpress/
ports:
- ${IP}:${PORT}:80 # change ip if required
volumes:
- ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
- ./wp-app:/var/www/html # Full wordpress project
#- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
#- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: "${DB_NAME}"
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
depends_on:
- db
links:
- db
Start by creating a Dockerfile to specify your application as shown below:
-
Code Sample :
# syntax=docker/dockerfile:1
FROM busybox
CMD echo "Hello world! This is my first Docker image."
Run
docker build -t <your_username>/my-private-repo .
to build your Docker image.
Run
docker run <your_username>/my-private-repo
to test your Docker image locally.
Run
docker push <your_username>/my-private-repo
to push your Docker image to Docker Hub. You should see output similar to:
Run
docker exec -it container-name sh
docker logs <contaner> > <logfile.txt>