当前位置:   article > 正文

【打工日常】使用docker部署在线Photopea用于linux下替代ps

【打工日常】使用docker部署在线Photopea用于linux下替代ps

一、Photopea介绍

linux没有ps适配,对于有时候工作来说确实不方便,我找了很久,才找到了一款功能可以跟ps接近的在线软件,使用docker部署就可以了。它是ps的最佳替代品之一,其界面几乎与ps相同,只不过它是在线的网页,但是功能基本上可以满足不是设计类的刚需。

二、本次实践介绍

本次实践简介

本次实践部署环境为个人测试环境

本地环境规划

本次实践环境规划:先下载Photopea-Offline.git文件,然后使用dockerfile创建镜像,最后通过docker-cli或者docker compose启动容器

镜像命名IP地址容器镜像版本操作系统版本
pslocalhostlatestubuntu 22.04

三、检查本地Docker环境

检查本地Docker版本

  1. 检查Docker版本:docker version
  2. root@WellDone:/home/goodjob# docker version
  3. Client: Docker Engine - Community
  4. Version: 25.0.0
  5. API version: 1.44
  6. Go version: go1.21.6
  7. Git commit: e758fe5
  8. Built: Thu Jan 18 17:09:49 2024
  9. OS/Arch: linux/amd64
  10. Context: default
  11. Server: Docker Engine - Community
  12. Engine:
  13. Version: 25.0.0
  14. API version: 1.44 (minimum version 1.24)
  15. Go version: go1.21.6
  16. Git commit: 615dfdf
  17. Built: Thu Jan 18 17:09:49 2024
  18. OS/Arch: linux/amd64
  19. Experimental: false
  20. containerd:
  21. Version: 1.6.27
  22. GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59
  23. runc:
  24. Version: 1.1.11
  25. GitCommit: v1.1.11-0-g4bccb38
  26. docker-init:
  27. Version: 0.19.0
  28. GitCommit: de40ad0
  29. root@WellDone:/home/goodjob#

检查Docker服务状态

检查Docker服务状态,确保Docker服务正常运行。

  1. systemctl status docker
  2. root@WellDone:/home/goodjob/Downloads# systemctl status docker
  3. ● docker.service - Docker Application Container Engine
  4. Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  5. Active: active (running) since Wed 2024-01-24 08:54:31 CST; 1 day 4h ago
  6. TriggeredBy: ● docker.socket
  7. Docs: https://docs.docker.com
  8. Main PID: 1549 (dockerd)
  9. Tasks: 65
  10. Memory: 419.5M
  11. CPU: 38.874s
  12. CGroup: /system.slice/docker.service
  13. ├─ 1549 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  14. ├─ 2010 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6379 -container-ip 172.17.0.2 -container-port 6379
  15. ├─ 2016 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6379 -container-ip 172.17.0.2 -container-port 6379
  16. ├─ 2029 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5432 -container-ip 172.17.0.3 -container-port 5432
  17. ├─ 2036 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 5432 -container-ip 172.17.0.3 -container-port 5432
  18. ├─123083 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.4 -container-port 8080
  19. └─123095 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8888 -container-ip 172.17.0.4 -container-port 8080
  20. 124 08:54:31 WellDone dockerd[1549]: time="2024-01-24T08:54:31.067895045+08:00" level=info msg="API listen on /run/docker.sock"
  21. 124 08:54:31 WellDone systemd[1]: Started Docker Application Container Engine.
  22. 124 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.185008219+08:00" level=info msg="ignoring event" container=8ad99af82d8a41dd661d>
  23. 124 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.189484205+08:00" level=warning msg="ShouldRestart failed, container will not be>
  24. 1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.024915139+08:00" level=info msg="ignoring event" container=27fd28e2993f31b170b8>
  25. 1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.029986730+08:00" level=warning msg="ShouldRestart failed, container will not be>
  26. 125 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.329180722+08:00" level=info msg="Container failed to exit within 10s of signal >
  27. 1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.350757439+08:00" level=info msg="ignoring event" container=b1223add00f36bbb3246>
  28. 1月 25 10:49:21 WellDone dockerd[1549]: time="2024-01-25T10:49:21.993755983+08:00" level=info msg="Container failed to exit within 10s of signal >
  29. 125 10:49:22 WellDone dockerd[1549]: time="2024-01-25T10:49:22.015822650+08:00" level=info msg="ignoring event" container=edb0e153b45dbe62acd8>
  30. lines 1-28/28 (END)

四、部署Photopea镜像

创建Photopea镜像

  1. a.创建存放ps的路径
  2. mkdir /opt/ps
  3. b.然后在此目录下载对应的资源
  4. git clone https://git.nixnet.services/DUOLabs333/Photopea-Offline.git .
  5. c.创建dockerfile
  6. touch Dockerfile
  7. vim Dockerfile
  8. d.dockerfile的内容
  9. ============================================================
  10. FROM alpine
  11. RUN sed -i 's/[dl-cdn.alpinelinux.org/mirrors.aliyun.com/g](http://dl-cdn.alpinelinux.org/mirrors.aliyun.com/g "dl-cdn.alpinelinux.org/mirrors.aliyun.com/g")' /etc/apk/repositories
  12. RUN cat /etc/apk/repositories
  13. WORKDIR /var/run/photopea
  14. RUN apk update && apk upgrade
  15. RUN apk add git python3
  16. COPY [www.photopea.com](http://www.photopea.com/ "www.photopea.com") ./[www.photopea.com](http://www.photopea.com/ "www.photopea.com")
  17. EXPOSE 2887
  18. ENTRYPOINT ["python3", "-m", "http.server", "--directory", "[www.photopea.com](http://www.photopea.com/ "www.photopea.com")", "2887"]
  19. ============================================================
  20. e.确保dockerfile跟git clone下载的内容是同一层路径,执行dockerfile创建镜像
  21. docker build . -t photopea:latest
  22. 实际上我已经创建好了镜像存在我的阿里云里面,可以直接拉取即可
  23. docker pull registry.cn-guangzhou.aliyuncs.com/welldene/docker:photopea

创建容器

使用docker快速创建photopea的容器。

  1. 完整创建过程:
  2. 1.使用docker-cli启动一个photopea的容器。
  3. docker run -d --name ps -p 2887:2887 registry.cn-guangzhou.aliyuncs.com/welldene/docker:photopea
  4. 2.使用docker-compose启动一个photopea的容器
  5. version: '3.9'
  6. services:
  7. welldene:
  8. image: 'registry.cn-guangzhou.aliyuncs.com/welldene/docker:photopea'
  9. ports:
  10. - '2887:2887'
  11. container_name: ps
  12. 3.容器启动正常,访问
  13. http://ip:2887

​​​检查容器运行状态

检查容器的运行状态,确保服务的正常运行。

docker ps

  1. root@WellDone:/home/goodjob# docker ps
  2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  3. ps registry.cn-guangzhou.aliyuncs.com/welldene/docker:photopea "python3 -m http.ser…" ps 6 minutes ago Up 6 minutes 0.0.0.0:2887->2887/tcp, :::2887->2887/tcp

五、访问photopea页面

访问photopea首页 访问地址:http://localhost:2887

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/184407
推荐阅读
相关标签
  

闽ICP备14008679号