Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the instructional copy for the removal of orphan containers #1464

Closed
rpkoller opened this issue Feb 25, 2019 · 7 comments
Closed

Improve the instructional copy for the removal of orphan containers #1464

rpkoller opened this issue Feb 25, 2019 · 7 comments

Comments

@rpkoller
Copy link
Collaborator

Describe the bug
I had a demo site running. By accident the project files including the .ddev directory got deleted by accident. I've recreated the config file by ddev config utilizing the same project name. The containers for the project ddevdemo are still present:

$> docker ps -a
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                     PORTS                                                                                      NAMES
6826498715e9        drud/ddev-ssh-agent:v1.6.0       "/entry.sh ssh-agent"    10 minutes ago      Up 10 minutes (healthy)                                                                                               ddev-ssh-agent
c98a11382b9e        drud/ddev-webserver:v1.6.0       "/start.sh"              11 hours ago        Exited (0) 8 minutes ago                                                                                              ddev-ddevdemo-web
86b05f6826f7        drud/phpmyadmin:v1.6.0           "/run.sh phpmyadmin"     11 hours ago        Exited (0) 8 minutes ago                                                                                              ddev-ddevdemo-dba
67208da9b1c2        drud/ddev-dbserver:v1.6.0-10.2   "/docker-entrypoint.…"   11 hours ago        Exited (0) 8 minutes ago                                                                                              ddev-ddevdemo-db
8fc5fcb91595        drud/ddev-router:v1.6.0          "/app/docker-entrypo…"   21 hours ago        Up 9 minutes (healthy)     0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8025->8025/tcp, 0.0.0.0:8036->8036/tcp   ddev-router
57b6a08be246        drud/ddev-bgsync:v1.6.0          "bg-sync"                47 hours ago        Up 30 minutes (healthy)

before the deletion webcache_enabled was set to true. after recreation the value was false by default again. I forgot about that and just hit ddev start.

$> ddev start
Starting ddevdemo...
Found orphan containers (ddev-ddevdemo-bgsync) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating ddev-ddevdemo-db ... done
Recreating ddev-ddevdemo-web ... done
Recreating ddev-ddevdemo-dba ... done

ddev-router is up-to-date

Expected behavior
Based on the context of the command I would have expected that the removal of orphans could be accomplished by ddev start --remove-orphans as the instructional copy implies Found orphan containers (ddev-ddevdemo-bgsync) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. But Error: unknown flag: --remove-orphans is returned only.

Version and configuration information (please complete the following information):

  • Host computer OS and Version: macOS 10.13.6 (17G5019)
  • Docker version information (use docker version) and insert it here.
Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:39 2019
 OS/Arch:           darwin/amd64
 Experimental:      false
  • ddev version information (use ddev version)
bgsync        	drud/ddev-bgsync:v1.6.0
cli           	v1.6.0
commit        	v1.6.0
db            	drud/ddev-dbserver:v1.6.0-10.2
dba           	drud/phpmyadmin:v1.6.0
ddev-ssh-agent	drud/ddev-ssh-agent:v1.6.0
docker        	failed to GetDockerVersion(): Get http://unix.sock/version: dial unix /var/run/docker.sock: connect: no such file or directory
docker-compose	1.23.2
domain        	ddev.local
router        	drud/ddev-router:v1.6.0
web           	drud/ddev-webserver:v1.6.0
  • config.yaml contents for the misbehaving project
APIVersion: v1.6.0
name: ddevdemo
type: php
docroot: ""
php_version: "7.1"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
mariadb_version: "10.2"
webcache_enabled: false
nfs_mount_enabled: false
provider: default
  • Do you have any custom configuration (nginx, php, mysql) in the .ddev folder? If so, have you tried without them?
@andrewfrench
Copy link
Contributor

andrewfrench commented Feb 25, 2019

Thanks for this @rpkoller, I can confirm that this suggestion isn't accepted by the ddev start command. The help text being emitted in this case is coming from the underlying call to docker-compose.

ddev should probably do a better job of either detecting this problem and offering a resolution, handle resolving the problem, or simply prevent the unhelpful suggestion from being printed. It seems to me that we should be able to provide docker-compose with the --remove-orphans option.

@andrewfrench andrewfrench self-assigned this Feb 25, 2019
@rfay
Copy link
Member

rfay commented Feb 25, 2019

The way to remove orphans is ddev rm <project>. I often use ddev rm -a as a quick-and-dirty. Does that resolve your issue?

@rpkoller
Copy link
Collaborator Author

@rfay yep thanks! the ddev rm <project> helped, and i also used. just stumbled back then across the ddev start --remove-orphans suggestion tried it and it failed. so i reported it in here. but the manual way with ddev rm i was already aware. just thought the suggested way by the instructional copy would been more convenient. ;)
and sorry for the late reply, but was a bit of land under overhere for a few weeks back then and afterwards i also forgot about the issue :/ sorry again! also a good way of dealing with the issue with the introduced pull request #1743

@tyler36
Copy link
Collaborator

tyler36 commented Nov 2, 2022

I think this should be reopen.

I can across this today after removing a ddev addon.

$ ddev start
Starting d9-demo... 
time="2022-11-02T16:28:35+09:00" level=warning msg="Found orphan containers ([ddev-d9-demo-chromedriver]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up." 
...

This message suggests "... running the command with the --remove-orphans" but does not specify what command to run.
I would assume it was the same command, but ddev start --remove-orphans generates a (rightly) unknown flag error.
I also tried ddev restart --remove-orphans but with the same results.

ddev rm -a as suggested by @rfay fixed the issue for me.

#1743 adds a new command to run, but is not mentioned when the error is produced, a new user might not even know it exists. The error should be updated to be more explict:
"If you removed or renamed this service in your compose file, run 'ddev delete` ."

@rfay
Copy link
Member

rfay commented Nov 2, 2022

The actual command to fix it these days would be ddev stop or ddev restart to fix this. It's caused by doing a ddev start while containers are running, or by disabling a service while project is running.

The odd thing about the orphans output as you know is that it's coming from docker-compose, and without putting some code in to trap that specific message there's no way to control it.

We wouldn't want people doing ddev delete for this, as it removes their database.

@hkirsman
Copy link

hkirsman commented Jan 27, 2024

ddev rm -a didn't help me.

What I did was to find the container with Docker command:
docker ps -a | grep full-name-ort-part-of-the-name-from-waning

docker rm hash_from_above_command

@rfay
Copy link
Member

rfay commented Jan 27, 2024

ddev rm -a is long obsolete.

Normally you'd just do a ddev poweroff, which removes any containers DDEV has created.

However, if there are other containers, or misconfigured containers, you can get all of them with docker rm -f $(docker ps -aq)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants