Podcast
Questions and Answers
Quid primum facere debes in assignatione DevOps?
Quid primum facere debes in assignatione DevOps?
- Scribere quaestiones SQL
- Construxit Dockerfile
- Creare rete (correct)
- Instaurare imagines SQL et Python
Quod gradum secutus est post creationem retis?
Quod gradum secutus est post creationem retis?
- Socius contenedor
- Suggere imagines SQL et Python (correct)
- Construxit Dockerfile
- Scribere scriptum Python
Quid praecipuum opus est ante sinum coniungere?
Quid praecipuum opus est ante sinum coniungere?
- Creare rete
- Scrībere imprimere Python
- Est construere contenedor Docker (correct)
- Conferre quaestiones SQL
Quid sequitur post constructionem conteni?
Quid sequitur post constructionem conteni?
Quae pars processus est ad creandum imagines SQL et Python?
Quae pars processus est ad creandum imagines SQL et Python?
Flashcards
Rete creatio
Rete creatio
Creatio retis in ambitu operationis.
Imagines SQL & Python
Imagines SQL & Python
Imagines SQL et Python adtractiones.
Scriptura Python
Scriptura Python
Scriptura Python ad operationes computatrorum et programmata.
Quaestiones SQL
Quaestiones SQL
Signup and view all the flashcards
Dockerfile creatio
Dockerfile creatio
Signup and view all the flashcards
Study Notes
DevOps Assignment #3
- Step 1: Network Creation
- Created a network named "app-network" using Docker.
- Network ID:
9cb7974abfcf6dec3e7f664eb5853f536795a73a7d3fc94eda2467bf2a34a737
- Other networks listed, including "bridge," "docker-app_app-network," and "host."
- Network drivers and scope noted (bridge, local, null).
Step 2: Pull SQL & Python Images
- Pulled the latest MySQL image from Docker Hub.
- Image status: up to date for mysql:latest.
- Image details include digest (
sha256:0255b469f0135a0236d672d60e3154ae2f4538b146744966d96440318cc822c6
) and source (docker.io/library/mysql:latest
). - Also pulled the Python 3.9-slim image.
Step 3: Python Script
- Python script imports
mysql.connector
for database interaction. - Connects to a database ('mysql') using credentials (user='testuser', password='testpassword', database='testdb').
- Executes a SQL query (
"Select * from users"
) to retrieve data. - Iterates through the result set (
result
) and prints each row.
Step 4: Dockerfile
- Uses a Python 3.9-slim base image.
- Sets the working directory to
/app
. - Copies the application code from an unspecified location into the
/app
directory. - Installs dependencies (
mysql-connector-python
) usingrequirements.txt
(no caching). - Runs the application using
python3 app.py
.
Step 5: Build Docker Python App Container
- Created a Docker container (
python-app
) using Docker. - Specifics: network (
app-network
), environment variables (DB_HOST=new-mysql-container-name
), port mapping (5000:5000
), and thedocker-app-python-app
image.
Step 6: Run Container
- Ran the container (python-app).
- Container ID:
a95f67f0dd65
- Container exited with status 1 (14 seconds ago).
SQL Queries
- Creates a database: Creates a database named
testdb
. - Selects a database: Switches to the
testdb
database. - Creates a table: Creates a table named
users
with columnsid
(auto-incrementing integer primary key),name
(string, length 100), andemail
(string, length 100). - Inserts data: Inserts a row into the
users
table withname
'test user' andemail
'[email protected]'.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.