DevOps Assignment #3: Docker & Python

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

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?

  • Socius contenedor
  • Suggere imagines SQL et Python (correct)
  • Construxit Dockerfile
  • Scribere scriptum Python

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?

<p>Fugit container (A)</p> Signup and view all the answers

Quae pars processus est ad creandum imagines SQL et Python?

<p>Pulsare imagines (C)</p> Signup and view all the answers

Flashcards

Rete creatio

Creatio retis in ambitu operationis.

Imagines SQL & Python

Imagines SQL et Python adtractiones.

Scriptura Python

Scriptura Python ad operationes computatrorum et programmata.

Quaestiones SQL

Quaestiones ad databases.

Signup and view all the flashcards

Dockerfile creatio

Dockerfile ad applicationem creandum.

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) using requirements.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 the docker-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 columns id (auto-incrementing integer primary key), name (string, length 100), and email (string, length 100).
  • Inserts data: Inserts a row into the users table with name 'test user' and email '[email protected]'.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Devops Assignment #3 PDF

More Like This

05A - Docker Networking
18 questions

05A - Docker Networking

EntrancedDobro6607 avatar
EntrancedDobro6607
Red de Contenedores Docker
5 questions
Redes en Docker
29 questions
Use Quizgecko on...
Browser
Browser