docker命令

docker ps -all --format "{{json .}}"   列出所有容器

docker ps --format "{{json .}}"  列出所有运行中的容器

docker images --format "{{json .}}"   列出所有image

docker rmi imagename  删除映像

docker rm 容器id或者容器名称   删除指定容器

 

using System.Net.Sockets;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            TcpListener tcpListener = new TcpListener(8000);
            Task.Run(() => {
                tcpListener.Start();
                while (true)
                {
                    var socket = tcpListener.AcceptSocket();
                    handle(socket);
                }
            });
            test();
            Console.ReadLine();
        }

        async static void handle(Socket socket)
        {
            try
            {
                using (socket)
                {
                    while (true)
                    {
                        var len = await socket.ReceiveAsync(new ArraySegment<byte>(new byte[1024]), SocketFlags.None);
                        if (len == 0)
                        {
                            break;
                        }
                        Console.WriteLine("收到" + len);
                    }
                }

            }
            catch (Exception)
            {

            }
        }

        static async void test()
        {
            Console.WriteLine("Hello22, World!");
            while (true)
            {
               await Task.Delay(1000);
                Console.WriteLine(DateTime.Now.ToString());
            }
        }
    }
}
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "ConsoleApp1.dll"]

 

posted @ 2023-08-09 21:24  IWing  阅读(12)  评论(0编辑  收藏  举报