Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| container:docker:dockerhub [2025/07/27 20:01] – created ilyasa | container:docker:dockerhub [2026/02/06 13:58] (current) – removed ilyasa | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Docker : Building and Deploying a Docker Image and push it to Docker Hub ====== | ||
| - | |||
| - | This guide walks you through containerizing an application using Docker. You'll write a Dockerfile, build the image, run it as a container, and push it to Docker Hub. | ||
| - | |||
| - | |||
| - | ===== Step 1: App Project Structure ===== | ||
| - | |||
| - | |||
| - | |||
| - | <code bash> | ||
| - | Demo-App | ||
| - | ├── Dockerfile | ||
| - | ├── index.html | ||
| - | └── nginx.conf | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | ===== Step 2: Create Dockerfile ===== | ||
| - | |||
| - | Create a `Dockerfile` in the same directory: | ||
| - | |||
| - | <code Dockerfile> | ||
| - | # Use the official Python image | ||
| - | FROM python: | ||
| - | |||
| - | # Set working directory | ||
| - | WORKDIR /app | ||
| - | |||
| - | # Copy files | ||
| - | COPY . . | ||
| - | |||
| - | # Install dependencies | ||
| - | RUN pip install flask | ||
| - | |||
| - | # Expose port | ||
| - | EXPOSE 5000 | ||
| - | |||
| - | # Run the application | ||
| - | CMD [" | ||
| - | </ | ||