Docker Community Forums

Share and learn in the Docker community.

Unable to prevent containers restarting

Hi,

I am working through the self paced training modules and wish to clean up my un-wanted containers, however I am unable to keep coantainers stopped so I can delete them, they seem to auto-restart.

===========
docker version on debian v8

root@debian8:/var/lib/docker/containers# docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:36:34 2017
OS/Arch: linux/amd64

Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:36:34 2017
OS/Arch: linux/amd64
Experimental: false
root@debian8:/var/lib/docker/containers#

===========

these keep restarting and I cannot delete them,

root@debian8:/var/lib/docker/containers# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b12352ba4bd3 dockersamples/examplevotingapp_result@sha256:9cbe68283fc56ac0d9b8c0f2656a4ae6df10e9a48956a48d0c9c6f230aea9374 “node server.js” 12 minutes ago Up 12 minutes 80/tcp vote_result.1.u96wfqt78lrvq4i3n2na9jn2k
e922d4922fe7 dockersamples/visualizer@sha256:f924ad66c8e94b10baeaf7bdb9cd491ef4e982a1d048a56a17e02bf5945401e5 “npm start” 12 minutes ago Up 12 minutes 8080/tcp vote_visualizer.1.pyxvq81zkwoddoiqtv0xu1us6
df698de3d02f ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 12 minutes ago Up 12 minutes test.3.4dzo2m8ko47o0kmf9voa7iapu
05a6b125df44 postgres@sha256:c681c72ff62b637b9ad3806a946f14450f74ee0888ca70ec1472a4e0552054c2 “docker-entrypoint…” 12 minutes ago Up 12 minutes 5432/tcp vote_db.1.y2h21s9edx02f6a5gzdie2cux
17c54c1ff570 ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 12 minutes ago Up 12 minutes test.1.trq2qzulpgecr49ep68w2so5k
877a3646d0e3 ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 12 minutes ago Up 12 minutes test.2.nkvsuob2z4id7xlaccgproyqb
99d1b46c401f alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 “ping docker.com” 12 minutes ago Up 12 minutes helloworld.1.psst1a3typ548jqoatq0519di
8d9f3e267503 redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 12 minutes ago Up 12 minutes 6379/tcp redis.2.clys882i62lp76da8eyw9jert
c36a74bd57a2 redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 12 minutes ago Up 12 minutes 6379/tcp redis.3.si1lfl228sjyij06g5eq1cka5
e0a8b2582594 redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 12 minutes ago Up 12 minutes 6379/tcp redis.1.id5qsy2xxosenckvtql2y9e1t
68c56f759e4b nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 12 minutes ago Up 12 minutes 80/tcp, 443/tcp objective_joliot.3.irble9popra96gjck5ncbiyba
ae7d505da1c9 nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 12 minutes ago Up 12 minutes 80/tcp, 443/tcp objective_joliot.2.o6ieg6hzph4najlm0c52p3id0
337caf458081 nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 12 minutes ago Up 12 minutes 80/tcp, 443/tcp objective_joliot.1.3trcgp22unyd1ouq0tjv0aptn
root@debian8:/var/lib/docker/containers#

How can I clean docker out to start again fresh? even how can I stop containers?

I have tried various commands like,

8><----------
552 docker ps -a -q | xargs -n 1 -P 8 -I {} docker stop {} ; rm -rf *
553 ls -l
554 docker ps -a -q | xargs -n 1 -P 8 -I {} docker stop {} ; rm -rf *
555 ls -l
556 systemctl stop docker
557 rm -rf *
558 ls -l
559 systemctl start docker
560 docker ps
561 docker ps
562 docker ps
563 ls -l
564 ls -l /etc/docker/
565 docker run --restart
566 docker run
567 docker run --help
568 docker run --restart=no *
569 docker run --restart=no
570 docker ps
571 docker run --restart=no vote_worker
572 docker update --restart=no 8741188df63f
573 docker update --restart=no 85e7290eefa4
574 docker update --restart=no 85e7290eefa4
575 docker ps
576 docker stop -v $(docker ps -a -q)
577 docker stop $(docker ps -a -q)
578 docker ps
579 docker ps
580 docker ps
581 docker ps
582 docker ps
583 docker update --restart=no postgres
584 docker update --restart=no vote_db.1.x9gvsh7o3ozcvckxnrpjldg5n
585 docker update --restart=no vote_visualizer.1.k4iph2evir4u7xtzqkvuqpj1f
586 docker ps
587 docker stop $(docker ps -a -q)
588 docker ps
589 docker ps
590 docker ps
591 docker update --restart=vote_redis.1.zdfrvp72n0gojt49p5nmkxroa redis.2.se4itsv9s76zm1fty0hxvyafg vote_visualizer.1.pn671tbfx8a08kqlti15qahhh vote_db.1.i2yvryfmt6xw8pv3lizcnc1p9
592 docker ps
593 docker stop $(docker ps -a -q)
594 ls -l
595 docker stop $(docker ps -a -q)
596 docker ps
597 docker update --restart=no
598 docker images
599 docker version
600 docker ps
601 history
8><-----

but they just keep restarting on me.

I tried this,

==========
root@debian8:/var/lib/docker/containers# docker update --restart=no $(docker ps -a -q)
40a4d7cac705
0e6a0b1b7956
b7b16cf383b8
1287683464a8
418fc8430f55
f49a462bc3f7
50048e811702
5eaca0fc1e60
ef81327b0894
37d14d345846
1ba0bce3fffc
732f06483c43
44711f24a412
b72206e30f47
ff6638cd8bd3
db8480acd9c8
a962cd6844f7
144f635da813
df8dc0e0289a
1fc851a75071
507d5fac721c
87c12cc2c9b5
309bb24ddd94
39e6514f57bc
97262b6e8fe3
6c4eadf431ae
ef98bd9b843c
root@debian8:/var/lib/docker/containers# docker stop $(docker ps -a -q)

40a4d7cac705
0e6a0b1b7956
b7b16cf383b8
1287683464a8
418fc8430f55
f49a462bc3f7
50048e811702
5eaca0fc1e60
ef81327b0894
37d14d345846
1ba0bce3fffc
732f06483c43
44711f24a412
b72206e30f47
ff6638cd8bd3
db8480acd9c8
a962cd6844f7
144f635da813
df8dc0e0289a
1fc851a75071
507d5fac721c
87c12cc2c9b5
309bb24ddd94
39e6514f57bc
97262b6e8fe3
6c4eadf431ae
ef98bd9b843c
root@debian8:/var/lib/docker/containers#
root@debian8:/var/lib/docker/containers#
root@debian8:/var/lib/docker/containers# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fa7a8ae94d5c dockersamples/examplevotingapp_result@sha256:9cbe68283fc56ac0d9b8c0f2656a4ae6df10e9a48956a48d0c9c6f230aea9374 “node server.js” 6 seconds ago Up Less than a second 80/tcp vote_result.1.yjxpe6qr6vua429afsq8vxci4
b14bc76e974d ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 6 seconds ago Up Less than a second test.2.5vuh1b8khons4pood7t16q8qi
9bb001da2a04 postgres@sha256:c681c72ff62b637b9ad3806a946f14450f74ee0888ca70ec1472a4e0552054c2 “docker-entrypoint…” 6 seconds ago Up Less than a second 5432/tcp vote_db.1.so3svx51y66wzcylm08vgq64x
b5e2dcb4532d ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 7 seconds ago Up 2 seconds test.3.zkxxuobbotimcdodywd7ro5nn
b7ea797f937e ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950 “sleep infinity” 8 seconds ago Up 2 seconds test.1.86551bd54wrlr0semwjxjvtui
f9963aa04473 alpine@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 “ping docker.com” 9 seconds ago Up 4 seconds helloworld.1.ed5bfngai8octt8uk241mkayf
3cf8b15e80d2 redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 17 seconds ago Up 11 seconds 6379/tcp redis.3.hfcousd58r003fbsc3v5zvov6
12ac4055435f nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 17 seconds ago Up 11 seconds 80/tcp, 443/tcp objective_joliot.3.g6rwcbagrbfy1pnwtua0t5tuq
b8874f96b01a redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 17 seconds ago Up 12 seconds 6379/tcp redis.2.bwt9b9tujqwoglk314qt0d7r4
b2f66da1025c redis@sha256:a1ccc6ff4e17e7e9ec0ba25dc9d99ca979171f4ef25d842baa835960b82322ae “docker-entrypoint…” 18 seconds ago Up 12 seconds 6379/tcp redis.1.5z1fn6m91utom06pn03dt5yeq
d89f0c8643e7 nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 18 seconds ago Up 13 seconds 80/tcp, 443/tcp objective_joliot.2.jbbhbdiqkxn6e3sr71fyhznot
fbb81ac20ddd nginx@sha256:4296639ebdf92f035abf95fee1330449e65990223c899838283c9844b1aaac4c “nginx -g 'daemon …” 19 seconds ago Up 14 seconds 80/tcp, 443/tcp objective_joliot.1.73r3lq2uyiifhuxshxzywpnqu
root@debian8:/var/lib/docker/containers#