instruction: Create a Dockerfile for fundamentals
output: ```dockerfile
  from the outside world and other hosts. It's a convenient starting point for most container interactions. However, for specific scenarios, you might want more control over the network configuration.Here's where the custom network comes in. You create a custom network by passing --network flag with the docker run command. All containers without a --network flag are attached to the default bridge network.Follow the steps to see how to connect a Postgres container to a custom network.Create a new custom network by using the following command:
  
  $ docker network create mynetwork
  Verify the network by running the following command:
  
  $ docker network ls
  This command lists all networks, including the newly created "mynetwork".Connect Postgres to the custom network by using the following command:
  
  $ docker run -d -e POSTGRES_PASSWORD=secret -p 5434:5432 --network mynetwork postgres
  This will start Postgres container in the background, mapped to the host port 5434 and attached to the mynetwork network. You passed the --network parameter to override the container default by connecting the container to custom Docker network for better isolation and communication with other containers. You can use docker network inspect command to see if the container is tied to this new bridge network.Key difference between default bridge and custom networksDNS resolution: By default, containers connected to the default bridge network can communicate with each other, but only by IP address. (unless you use --link option which is considered legacy). It is not recommended for production use due to the various
  technical shortcomings. On a custom network, containers can resolve each other by name or alias.Isolation: All containers without a --network specified are attached to the default bridge network, hence can be a risk, as unrelated containers are then able to communicate. Using a custom network provides a scoped network in which only containers attached to that network are able to communicate, hence providing better isolation.Manage the resourcesBy default, containers are not limited in their resource usage. However, on shared systems, it's crucial to manage resources effectively. It's important not to let a running container consume too much of the host machine's memory.This is where the docker run command shines again. It offers flags like --memory and --cpus to restrict how much CPU and memory a container can use.
  
  $ docker run -d -e POSTGRES_PASSWORD=secret --memory="512m" --cpus=".5" postgres
  The --cpus flag specifies the CPU quota for the container. Here, it's set to half a CPU core (0.5) whereas the --memory flag specifies the memory limit for the container. In this case, it's set to 512 MB.Override the default CMD and ENTRYPOINT in Docker ComposeSometimes, you might need to override the default commands (CMD) or entry points (ENTRYPOINT) defined in a Docker image, especially when using Docker Compose.Create a compose.yml file with the following content:
  
  services:
   postgres:
   image: postgres
   entrypoint: ["docker-entrypoint.sh", "postgres"]
   command: ["-h", "localhost", "-p", "5432"]
   environment:
   POSTGRES_PASSWORD: secret The Compose file defines a service named postgres that uses the official Postgres image, sets an entrypoint script, and starts the container with password authentication.Bring up the service by running the following command:
  
  $ docker compose up -d
  This command starts the Postgres service defined in the Docker Compose file.Verify the authentication with Docker Desktop Dashboard.Open the Docker Desktop Dashboard, select the Postgres container and select Exec to enter into the container shell. You can type the following command to connect to the Postgres database:
  
  # psql -U postgres
  
  NoteThe PostgreSQL image sets up trust authentication locally so you may notice a password isn't required when connecting
  ```