The flow works like this:
- You write a Dockerfile (the plans for the blueprint for our Container).
- You
docker build
it into an Image (our blueprint). - Then, you launch the Container via
docker run
.
The commands are:
docker build .
docker run -d <image-id>
docker ps
To see if this worked,
docker ps
, look for running containers.docker exec -it <container ID> bash
When done, you can stop and remove.
docker stop <container-id>
ordocker stop $(docker ps -a -q)
docker rm <container-id>
ordocker rm $(docker ps -a -q)
For run_script.sh,
- Use
chmod 777 run_script.sh
- exposes the port for the container with
docker build --tag python-docker .
docker run -d -p 5000:5000 <image>
- https://docs.docker.com/config/containers/container-networking/
- go into the container with
docker exec -it <container-id> bash
- install curl
apt-get update
andapt-get install curl
inside the container curl --location --request GET '0.0.0.0:5000'