-
Notifications
You must be signed in to change notification settings - Fork 0
Create A Container
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)"/src:/code/src \
--name py-fapi-31-slim-web-server \
py-fapi-31-slim:latest
-
Using
-d
To detach the running container process from the terminal so it can run in the background.
-
Using
--network host
To use the Host machine network directly.
-
Using
-v "$(pwd)"/src:/code/src
To Volume Mount the folder
src
from the current folder to/code/src
on the running container. It is where FAPI serves the content from & allows for realtime change updates. -
Using
--name py-fapi-31-slim-web-server
To name the Container being created.
-
Using
py-fapi-31-slim:latest
To specify the docker image to create the container from.
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)"/src:/code/src \
--name py-fapi-31-slim-web-server \
py-fapi-31-slim:latest
-
Using
-d
To detach the running container process from the terminal so it can run in the background.
-
Using
--network bridge
To use the Bridge network with port forward mapping.
-
Using
-p 8080:80/tcp
To map port 8080 on the Host machine to port 80 on the Container when using the
--network bridge
. -
Using
-v "$(pwd)"/public_html:/var/www/html
To Volume Mount the folder
src
from the current folder to/code/src
on the running container. It is where FAPI serves the content from & allows for realtime change updates. -
Using
--name py-fapi-31-slim-web-server
To name the Container being created.
-
Using
py-fapi-31-slim:latest
To specify the docker image to create the container from.