pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.41k stars 1.57k forks source link

"~" not stripped from image before creating container #3310

Closed grimsi closed 3 years ago

grimsi commented 3 years ago

Background:

Panel or Wings: Wings Version of Wings: 1.4.0 Wings Logs:

ERROR: [Apr 28 17:16:29.989] failed to create server environment during install process error=environment/docker: failed to create container: Error response from daemon: invalid reference format server=7bdf25ef-8efe-4169-b91c-92341c7dc245

Stacktrace:
Error response from daemon: invalid reference format
environment/docker: failed to create container
github.com/pterodactyl/wings/environment/docker.(*Environment).Create
    /wings/environment/docker/container.go:233
github.com/pterodactyl/wings/server.(*Server).CreateEnvironment
    /wings/server/server.go:215
github.com/pterodactyl/wings/router.postCreateServer.func1
    /wings/router/router_system.go:68
runtime.goexit
    /usr/local/go/src/runtime/asm_amd64.s:1373

Server's OS: Ubuntu 20.04 Your Computer's OS & Browser: Ubuntu 20.04 & Firefox 88

Describe the bug

Local images are prefixed with a tilde "\~" to avoid doing trying a pull of the image. The tilde is however not stripped when passing the image name to docker and thus the creation of the container fails. Somewhere in this code segment the image string has to be stripped if it starts with "\~": https://github.com/pterodactyl/wings/blob/3fda5485419404f87212eb06361f6834dc07e4b5/environment/docker/container.go#L159

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.7.0)

Server:
 Containers: 7
  Running: 7
  Paused: 0
  Stopped: 0
 Images: 29
 Server Version: 20.10.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.8.0-50-generic
 Operating System: Ubuntu 20.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.08GiB
 Name: Simon-Legion
 ID: N32K:FECD:LCQZ:CVJ4:B2UG:43DV:5SYO:JLDU:EO6E:YK7K:H5R5:2PIB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Output of uname -a: Linux Simon-Legion 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

To Reproduce

  1. Create a new egg or edit an existing egg.
  2. Set the image to a local image (aka prefix with "\~") and save
  3. Create a server with this egg
  4. Server will be stuck at "Installing" and Wings will show an error.

Expected behavior Server gets created using the local image.

parkervcp commented 3 years ago

If I am reading this right you are using a local container for the install process?

grimsi commented 3 years ago

No, the local container image is used to run the server

ds58 commented 3 years ago

I have this issue as well when using local docker images