Changes between Version 5 and Version 6 of dockerdeployment2023


Ignore:
Timestamp:
Dec 4, 2023, 4:25:34 AM (12 months ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • dockerdeployment2023

    v5 v6  
    11=== Part 1: ===
    2 Installing Docker on Ubuntu Server
     2
     3'''Installing Docker on Ubuntu Server'''
    34
    451. Update Your System: Ensure your system package database is up-to-date.
    56
    6 `$ sudo apt update `
    7 
    8 `$ sudo apt upgrade`
     7` sudo apt update `
     8
     9`sudo apt upgrade`
    910
    10112. Install Docker: Install Docker using the convenience script provided by Docker.
    1112
    12 `$ curl -fsSL https://get.docker.com -o get-docker.sh`
    13 
    14 `$ sudo sh get-docker.sh`
     13` curl -fsSL https://get.docker.com -o get-docker.sh`
     14
     15` sudo sh get-docker.sh`
    1516
    16173. Add User to Docker Group (Optional): If you want to run Docker commands without sudo, add your user to the docker group.
    1718
    18 `$ sudo usermod -aG docker ${USER}`
     19` sudo usermod -aG docker ${USER}`
    1920
    2021Log out and log back in for the group changes to take effect.
     
    22234. Start and Enable Docker: Ensure Docker starts on boot.
    2324
    24 `$ sudo systemctl enable docker`
    25 
    26 `$ sudo systemctl start docker`
     25` sudo systemctl enable docker`
     26
     27` sudo systemctl start docker`
    2728
    28295. Verify Docker Installation: Check the Docker version to ensure it's installed correctly.
    2930
    30 `$ docker --version`
    31 
    32 === 6. Deploying a Sample Web Application using Docker ===
     31` docker --version`
     32
     336. Deploying a Sample Web Application using Docker
    3334
    34356.1 Pull a Sample Web Application Image: For this guide, we'll use a simple HTTP server image from Docker Hub.
    3536
    36 `$ docker pull httpd`
     37` docker pull httpd`
    3738
    38396.2 Run the Web Application: Start a container using the httpd image. This will run the web server on port 8080.
    3940
    40 `$ docker run -d -p 8080:80 --name sample-webapp httpd`
     41` docker run -d -p 8080:80 --name sample-webapp httpd`
    4142
    42436.3 Access the Web Application: If you're accessing the server locally, open a web browser and navigate to: (Since you are connected via SSH lets install a text-based web browser lynx.)
    4344
    44 `$ sudo apt-get install lynx`
    45 
    46 `$ lynx http://localhost:8080`
     45` sudo apt-get install lynx`
     46
     47` lynx http://localhost:8080`
    4748
    48496.4 Stop and Remove the Web Application (Optional):
    4950When you're done testing the web application, you can stop and remove the container.
    5051
    51 `$ docker stop sample-webapp`
    52 
    53 `$ docker rm sample-webapp`
     52` docker stop sample-webapp`
     53
     54` docker rm sample-webapp`
    5455 
    5556Extra Ref:
    5657
    57 https://linuxhint.com/best_linux_text_based_browsers/
    58 https://romanzolotarev.com/ssh.html
    59  
    60 Basic Docker Commands and Their Usage
     58[https://linuxhint.com/best_linux_text_based_browsers/][]
     59[https://romanzolotarev.com/ssh.html]
     60 
     61==== Basic Docker Commands and Their Usage ====
    6162
    6263•          ` docker --version`
     
    6465        Example: `docker --version`
    6566
    66 •           `docker inf`o
     67•           `docker info`
    6768        Usage: Provides detailed information about the Docker installation.
    6869        Example:` docker info`
     
    108109        Example: `docker logs my_container`
    109110 
    110 Troubleshooting Common Docker Container Issues
     111=== Troubleshooting Common Docker Container Issues ===
    111112
    112113•           Container Fails to Start
    113114
    114         Check Logs: Use docker logs <container_name> to check for any error messages.
    115         Inspect Configuration: Ensure that the Docker run command has the correct parameters, such as port mappings and volume mounts.
     115        Check Logs: Use `docker logs <container_name>` to check for any error messages.
     116       
     117         Inspect Configuration: Ensure that the Docker run command has the correct parameters, such as port mappings and volume mounts.
    116118
    117119•           Networking Issues
    118120
    119         Check IP Address: Use docker inspect <container_name> | grep IPAddress to find the container's IP address.
     121        Check IP Address: Use `docker inspect <container_name> | grep IPAddress` to find the container's IP address.
     122       
    120123        Check Port Bindings: Ensure that the ports inside the container are correctly mapped to the host using the -p option.
    121         You may use docker port <container_name> to further check the port mapping.
     124        You may use `docker port <container_name>` to further check the port mapping.
    122125
    123126•           File or Directory Not Found in Container