Skip to content

Instantly share code, notes, and snippets.

@jhcao23
Created December 9, 2023 04:50
Show Gist options
  • Save jhcao23/7bf8d5a86c613b43f30603d015ad6471 to your computer and use it in GitHub Desktop.
Save jhcao23/7bf8d5a86c613b43f30603d015ad6471 to your computer and use it in GitHub Desktop.
deploy shadowsocks server as docker in Amazon Linux 2023

Here's a summary of the useful commands and concepts we discussed today, which you can include in your lecture notes:

  • image: Amazon Linux 2023 in AWS LightSail
  1. Stopping and Starting Docker Containers with Docker Compose:

    • Start containers: docker-compose up -d
    • Stop containers: docker-compose down
  2. Managing the Docker Service:

    • Start Docker service: sudo systemctl start docker
    • Stop Docker service: sudo systemctl stop docker
    • Check Docker service status: sudo systemctl status docker
    • Disable Docker auto-start on boot: sudo systemctl disable docker
  3. Managing the Docker Socket:

    • The Docker socket (docker.socket) can trigger the Docker service to start under certain conditions. To fully control the Docker service, including the socket, the following commands are useful:
    • Stop the Docker socket: sudo systemctl stop docker.socket
    • Disable Docker socket: sudo systemctl disable docker.socket
    • Start the Docker socket (if previously disabled): sudo systemctl start docker.socket
  4. Role of Docker Socket:

    • The Docker socket is used by the Docker daemon to listen for Docker API requests. It's an entry point for the Docker client (docker command) to communicate with the Docker daemon.
    • Managing the Docker socket is important when you want to ensure that Docker does not restart automatically or accept connections in scenarios where you've stopped or disabled the Docker service.

Including these commands and understanding the role of docker.socket is important for comprehensive Docker management, especially in environments where precise control over Docker's behavior is necessary.

  1. Working with Docker Containers and Images:

    • List running containers: docker ps
    • List all Docker images: docker images
    • Stop a specific container: docker stop [CONTAINER_ID]
  2. Viewing Logs in Docker:

    • View logs for all services in Docker Compose: docker-compose logs
    • View logs for a specific service: docker-compose logs [service-name]
    • Follow logs in real-time: docker-compose logs -f [service-name]
    • View logs of a specific container: docker logs [container-name]
  3. Updating the Operating System:

    • Update packages (CentOS/RHEL): sudo yum update
  4. Monitoring Network Traffic and DNS Queries:

    • Concepts about setting up DNS query logging for monitoring domain-level access.
    • Use of a DNS server with logging capability.
    • Pointing Shadowsocks to use a custom DNS server for resolving domain names.
  5. Troubleshooting Network Errors in Shadowsocks:

    • Analyzing error messages like "ERROR: connect: Address not available" for potential DNS resolution issues, blocked IP addresses, server or client misconfigurations, or network stability problems.
  6. General System Management:

  • Restarting the Linux server: sudo reboot
  • Checking for typographical errors and ensuring correct command syntax.

Remember, the context in which these commands are used is important. They're primarily relevant for managing Docker environments, handling containerized applications, and basic system administration on Linux servers. Also, it's crucial to consider network security, privacy, and compliance with legal regulations when monitoring network traffic or user activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment