Update deploy.yaml gsdfg
Update deploy.yaml
gsdfg
Sample Python + Alpine project to run “Hello World” inside a Docker container.
Docker installed on your system.
Clone or navigate to the project directory where the Dockerfile and hello.py are located.
Build the Docker image by running the following command in the project terminal:
docker build -t python-hello-world:1.0.0 .
This will create a Docker image named python-hello-world with the tag 1.0.0.
Verify the image was built by listing your Docker images. Run:
docker images
You should see the python-hello-world image in the list with the version 1.0.0.
Run the Docker container Run the image in a new container. You can specify a custom container name by replacing :
docker run --name <CONTAINER_NAME> -it python-hello-world:1.0.0
Replace with the name you want to give the container (e.g., hello-container).
View the output: Once the container starts, you should see the message:
Hello World
This indicates that the Python script executed successfully inside the container.
To stop and remove the container, run the following:
Stop the container:
docker stop <CONTAINER_NAME>
Remove the container:
docker rm <CONTAINER_NAME>
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
preprod-python-helloworld
Sample Python + Alpine project to run “Hello World” inside a Docker container.
Prerequisites
Docker installed on your system.
Build the image
Clone or navigate to the project directory where the Dockerfile and hello.py are located.
Build the Docker image by running the following command in the project terminal:
This will create a Docker image named python-hello-world with the tag 1.0.0.
Verify the image was built by listing your Docker images. Run:
You should see the python-hello-world image in the list with the version 1.0.0.
Run the Docker container Run the image in a new container. You can specify a custom container name by replacing :
Replace with the name you want to give the container (e.g., hello-container).
View the output: Once the container starts, you should see the message:
This indicates that the Python script executed successfully inside the container.
Cleanup
To stop and remove the container, run the following:
Stop the container:
Remove the container: