-
Notifications
You must be signed in to change notification settings - Fork 1
Create A Container
Evil Wizard edited this page Feb 10, 2023
·
2 revisions
This creates a named container and attaches it to the host network and may cause port conflict if the host machine is already listening on any exposed ports from the Docker Image being used.
sudo docker run \
-d \
--network host \
-v "$(pwd)"/public_html:/var/www/html \
--name php-7-4-web-server \
php-7-4-web-server:latest
This creates a named container and attaches it to the bridge network and allows for port forward mapping from the host to the Container.
sudo docker run \
-d \
--network bridge \
-p 8080:80/tcp \
-v "$(pwd)"/public_html:/var/www/html \
--name php-7-4-web-server \
php-7-4-web-server:latest
-
Using
-v "$(pwd)"/public_html:/var/www/html
To Volume Mount the folder
public_html
from the current folder to/var/www/html
on the running container. It is where Apache serves the content from & allows for realtime change updates. -
Using
-p 8080:80/tcp
To map port 8080 on the Host machine to port 80 on the Container using the bridge network.
-
Using
--name php-7-4-web-server
To name the Container being created.