xxxxxxxxxx public List GetStudent(int id, string name){ int pageCount = 0; using (var db = SugarDao.GetInstance()) { //Form(“Student”,”s”)语法优化成 Form(“s”) var sable = db.Sqlable().Form(“s”).Join(“l”, “s.sch_id”, “l.id”, JoinType.INNER); if (!string.IsNullOrEmpty(name)) { sable = sable.Where(“s.name=@name”); } if (!string.IsNullOrEmpty(name)) { sable = sable.Where(“s.id=@id or s.id=100”); } if (id > 0) { sable = sable.Where(“l.id in (select top 10 id from school)”);//where加子查询 } //参数 var pars = new { id = id, name = name }; pageCount = sable.Count(pars); return sable.SelectToList(“s.*”, pars); }}csharp
root@vm02:~/webdemo# docker-compose logs Attaching to nginxdemo, webdemo.compose nginxdemo | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginxdemo | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginxdemo | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginxdemo | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf nginxdemo | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version nginxdemo | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginxdemo | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh nginxdemo | /docker-entrypoint.sh: Configuration complete; ready for start up nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: using the "epoll" event method nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: nginx/1.21.5 nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: OS: Linux 5.4.0-94-generic nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: start worker processes nginxdemo | 2022/01/19 08:27:00 [notice] 1#1: start worker process 30 webdemo.compose | warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60] webdemo.compose | Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. webdemo.compose | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] webdemo.compose | No XML encryptor configured. Key {887cc5db-dcb2-4d26-886d-0f3aa1c787c9} may be persisted to storage in unencrypted form. webdemo.compose | info: Microsoft.Hosting.Lifetime[0] webdemo.compose | Now listening on: http://[::]:80 webdemo.compose | info: Microsoft.Hosting.Lifetime[0] webdemo.compose | Application started. Press Ctrl+C to shut down. webdemo.compose | info: Microsoft.Hosting.Lifetime[0] webdemo.compose | Hosting environment: Production webdemo.compose | info: Microsoft.Hosting.Lifetime[0] webdemo.compose | Content root path: /app
容器列表
docker ps
1 2 3 4
root@vm02:~/webdemo# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0d4ea2075140 nginx "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8082->80/tcp, :::8082->80/tcp nginxdemo 686adcb2655a webdemo_webdemo "dotnet WebDemo.dll" About a minute ago Up About a minute 0.0.0.0:8081->80/tcp, :::8081->80/tcp webdemo.compose
访问
查看版本
docker-compose --version
最后
至此,已经完成了通过Docker-compose动态编排容器,实现Nginx反向代理.Net core web 应用程序