Example used to demonstrate docker init
CLI for a simple Hello Docker Rust Program
![image](https://private-user-images.githubusercontent.com/313480/254960705-3c4fda17-01d2-4d0e-ba72-2a8aa7a2e6ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3MjYyNDYsIm5iZiI6MTczOTcyNTk0NiwicGF0aCI6Ii8zMTM0ODAvMjU0OTYwNzA1LTNjNGZkYTE3LTAxZDItNGQwZS1iYTcyLTJhOGFhN2EyZTZhZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQxNzEyMjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNzEyN2JhZjk0OGUzNzBlM2QzYTM3ZWM3NWU0OTlkMjIyODFhN2E5ZjA1Y2YxOTcyYzI0ZmYyYzdiNDlhN2JiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.8U0R2q4GNdU4ina1DrPGu1O_SF1Z--LDgR2lEMhQ36Y)
We will be using two crates in this sample app. A "crate" refers to a package or a module in the Rust ecosystem. It is the fundamental unit of code distribution in Rust. Crates allow you to organize, share, and reuse code across different projects and applications.
- warp
- tokio
The first crate is warp. The "warp" provides the web framework for building HTTP applications. Second, we will use tokio. The "tokio" provides the asynchronous runtime to enable efficient handling of concurrent and non-blocking I/O operations. Together, these dependencies make it easy to create efficient and high-performance web applications in Rust. We specify them in our Cargo.toml file.
git clone https://github.com/dockersamples/docker-init-demos
cd docker-init-demos/rust
cargo init
cargo build --release
docker init
docker init
Welcome to the Docker Init CLI!
This utility will walk you through creating the following files with sensible defaults for your project:
- .dockerignore
- Dockerfile
- compose.yaml
Let's get started!
WARNING: The following Docker files already exist in this directory:
- .dockerignore
? Do you want to overwrite them? Yes
? What application platform does your project use? Rust
? What version of Rust do you want to use? 1.70.0
? What port does your server listen on? 3030
CREATED: .dockerignore
CREATED: Dockerfile
CREATED: compose.yaml
✔ Your Docker files are ready!
Take a moment to review them and tailor them to your application.
When you're ready, start your application by running: docker compose up --build
Your application will be available at http://localhost:3030
docker compose up -d --build
## .
## ## ## ==
## ## ## ## ## ===
/""""""""""""""""\___/ ===
{ / ===-
\______ O __/
\ \ __/
\____\_______/
Hello from Docker!
![image](https://private-user-images.githubusercontent.com/313480/254960728-f4173e6e-8f88-4ada-9651-2142ca9641a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3MjYyNDYsIm5iZiI6MTczOTcyNTk0NiwicGF0aCI6Ii8zMTM0ODAvMjU0OTYwNzI4LWY0MTczZTZlLThmODgtNGFkYS05NjUxLTIxNDJjYTk2NDFhNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQxNzEyMjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jYWEwZTJiOWFhZDE1YzBkNDY4NzFhODE3NDkzZGZlNDBmMGZhODk0YzVmMzg5ZTYwMTgxOGE2YmIwOTBiYWQwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.MhdVRQNyyejXGwesb7Ey6e05BRNea2OPcwSnkCwIfy0)