``` sh
# Using port 8090 to avoid conflicts with n8n/Traefik
docker run -d --name website -p 8090:80 nginx
docker exec website sh -c 'echo " <h1>NetworkChuck Coffee</h1>" > /usr/share/nginx/html/index.html'
```
Let's break down those two Docker commands step-by-step.
In short, the first command starts a web server, and the second command changes the default webpage on that server.
---
### Command 1: `docker run -d --name website -p 8090:80 nginx`
This command creates and starts a new Nginx web server container.
- **`docker run`**: The basic command to create and run a Docker container from an image.
- **`-d`**: Stands for **detached mode**. It runs the container in the background so you can continue using your terminal.
- **`--name website`**: Gives your container a simple, memorable name ("website"). This makes it easier to refer to later, which you'll see in the second command.
- **`-p 8090:80`**: This is the **port mapping**. It connects a port on your computer (the host) to a port inside the container.
- `8090` is the port on your computer.
- `80` is the port inside the container where the Nginx server is listening for traffic.
- This means any web traffic sent to your computer on port `8090` will be forwarded to the container's port `80`.
- **`nginx`**: This is the **Docker image** to use. Docker pulls the official `nginx` image (a lightweight web server) from Docker Hub to build the container.
**Result**: A web server is now running in a container named `website`. You can access it by going to `http://localhost:8090` in your browser.
---
### Command 2: `docker exec website sh -c '...'`
This command executes a command _inside_ the container you just created.
- **`docker exec`**: The command to "execute" a new command inside a running container.
- **`website`**: The name of the target container (the one you named earlier).
- **`sh -c '...'`**: This tells Docker to run a shell command inside the container.
- **`sh`**: Starts the basic command-line shell inside the container.
- **`-c`**: Tells the shell to execute the command that follows in the single quotes.
- **`'echo "<h1>NetworkChuck Coffee</h1>" > /usr/share/nginx/html/index.html'`**: This is the actual command being run.
- **`echo "<h1>...</h1>"`**: This prints the HTML text for a main heading that says "NetworkChuck Coffee".
- **`>`**: This is a redirection operator. It takes the output from the `echo` command and writes it into a file.
- **/usr/share/nginx/html/index.html**: This is the path to the default file that the Nginx server shows to visitors. By overwriting this `index.html` file, you are changing the content of the website's homepage.
**Result**: The default Nginx welcome page is replaced with a simple page that just has the heading **"NetworkChuck Coffee"**.