Profile picture
Sidharth R
  • Home
  • Posts
  • Journal
  • Home
  • Posts
  • Journal
  • Search

Docker assignment 1

Updated: 07 Apr 2026 ⚬ Page views: loading...

Question/assignment

• Run a nginx, a mysql, and a httpd (apache) server
• Run all of them –detach (or -d), name them with –name
• nginx should listen on 80:80, httpd on 8080:80, mysql on 3306:3306
• When running mysql, use the –env option (or -e) to pass in MYSQL_RANDOM_ROOT_PASSWORD=yes
• Use docker container logs on mysql to find the random password it created on startup
• Clean it all up with docker container stop and docker container rm (both can accept multiple names or ID’s)
• Use docker container ls to ensure everything is correct before and after cleanup

Solution

Nginx on 80:80

docker conainer run --detach --publish 1234:80 nginx

Mysql on 3306:3306

docker container run -d --publish 3306:3306 -e MYSQL_RANDOM_ROOT_PASSWORD=yes mysql

Httpd on 8080:80

docker container run -d -p 8080:80 httpd

Nerdsid.com

Links
  • Home
  • Contact
  • About
  • Posts
  • Journal
  • Quotes
  • Notes
  • Style guide
© 2026 Sidharth R.
All content on this website is licensed under CC BY-NC-SA 4.0.