How to delete - edit a Docker

  • Well even though it seems easy everything in linux just wont let you do it the easy way... just because of the fun irritating you like you don't have anything else to do in your life better than trying all the way to solve things that should work.
    So, there goes lying unerneath 2 questions about dockers.
    1) I suppose the first step to let you delete it is the Docker not running ok logical and understandable. Let's deep a little more and think that if they have directories shared using maybe the have to de attached somehow from those directories (Not only delete the whole directory with data but still refused to be deleted). What else need to be done in order to let you simply press the remove button and delete it as plugins do????? It gives a warning each time that can't delete a usr/bin ... something directory.


    2)In Dockers there is the Docker Images and Docker Containers pane.... If I want to modify something afterwards which pane do I use and why when
    I click modify the Docker Containers many of the options I have set are lost (which warns me before I enter its going to happen - <<please
    be aware that all non-persistent data within the container will be deleted)????

  • You can remove a container like this:
    docker kill <containername> && docker rm <containername>
    You can also do this with all containers running:
    docker kill $(docker ps -q) && docker rm $(docker ps -a -q)
    You need to think of the image as a basis to your container. The image is what you pull from the repo when you use something like docker pull debian.
    The container itself is just a running instance which started with this image and can be different now, depending on what ran after starting it.
    To delete an image you need docker rmi <imagename>. You need to kill and rm the containers based on that image first.
    If you want to change an image you need to create a file named Dockerfile. You can than build another layer based on the instructions given in the dockerfile by docker build -t <newImagename> <pathToDockerfile>.
    For things to write into the Dockerfile please use google or just any example Dockerfile you can find on dockerhub.
    If you want to make changes to a running container connect to it like this:
    docker exec -it <containerName> /bin/bash, maybe sh if bash is not installed inside the container. You will than get a terminal that is running inside the container.
    Still something missing?

  • Well that was quite an answer ...still I have to get all that straight


    First the message I m getting upon deletion of the image (container doesnt even have a button to delete anything) is:

    Code
    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; docker rmi 3829cbd13d15' with exit code '1':
    Error #0:
    OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; docker rmi 3829cbd13d15' with exit code '1':  in /usr/share/php/openmediavault/system/process.inc:182
    Stack trace:
    #0 /usr/share/openmediavault/engined/rpc/docker.inc(292): OMV\System\Process->execute()
    #1 [internal function]: OMVRpcServiceDocker->deleteImage(Array, Array)
    #2 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
    #3 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('deleteImage', Array, Array)
    #4 /usr/sbin/omv-engined(536): OMV\Rpc\Rpc::call('Docker', 'deleteImage', Array, Array, 1)
    #5 {main}


    Also your answer means that you can add docker by gui but it doesnt give you the option to delete it afterwards? haahha epic!!!
    I ll try your commands in a small docker which is easy to reinstall and also giving me the above error. Now that you read the error do I still have to use the commands and which order? From
    Container first and image afterwards? From cli root@openmediavault:# I m running the command straight away?


    Also in this command docker kill $(docker ps -q) && docker rm $(docker ps -a -q) where do i specify about which docker I want to remove?

  • I have to admit that I never used the gui for this before, but I just tested it to be working at my machine.
    From the error massage I can see you try to delete the image. Did you stop and delete all containers based on that image before?
    Because otherwise docker will not be able to remove that.


    About your last question. This is to remove ALL containers. $(docker ps -q) returns a list of all running containers in a way it can be passed as an argument (done bei the q flag). $(docker ps -q -a) returns all containers, also those stopped. As all containers have been stopped before, we can now remove all. If you want to do this with a specific container do it like my first example.
    If you want to do this on command line, yes you just do this after login in as root or any other user with rights to docker (it might be root only at debian/omv, otherwise you can specify a docker group which as rights to user docker.pid and all users that are added to the group docker have full rights using docker)

  • I have to admit that I never used the gui for this before, but I just tested it to be working at my machine.
    From the error massage I can see you try to delete the image. Did you stop and delete all containers based on that image before?
    Because otherwise docker will not be able to remove that.


    About your last question. This is to remove ALL containers. $(docker ps -q) returns a list of all running containers in a way it can be passed as an argument (done bei the q flag). $(docker ps -q -a) returns all containers, also those stopped. As all containers have been stopped before, we can now remove all. If you want to do this with a specific container do it like my first example.
    If you want to do this on command line, yes you just do this after login in as root or any other user with rights to docker (it might be root only at debian/omv, otherwise you can specify a docker group which as rights to user docker.pid and all users that are added to the group docker have full rights using docker)

    Well I would if gui would give me an option to do so.


    Why would I want to delete every container? Most times one - two of them will cause problems or by the first installatiion or afterwards after an update or something. So most cases you need to remove each one causing the problem. So I ll try the first command for cli root promt


    ...and that's my fiends I call a f@cking AAAA answer!!! Straight to the point leaving the user option to ask for more or use it right from scratch!!!! Even though I didn't use it yet awesome my friend all I can say. Maybe someone sticks that because I doubt 85-90% of users in here knew that already.


    Thanks again!!!

  • Thanks.
    I delete all containers (sometimes even images) regularly on my desktop, as they take up a lot of space after some time and I use a lot of different ones for testing all kind of stuff. I develop a lot of software inside those containers. When there was an update to some dependencies and jenkins tests show that something is not working anymore, I pull the docker and change the software. By this I collect a lot of containers on my system. On my websevers on the other hand I dont do that of course. Of course you can also run them from start with the rm flag.
    In the gui beneath the docker images there are docker containers, at least at my system. The button where it says start is a dropdown menu. You can stop a container there and on the right there is also a delete button.

  • Thanks.
    I delete all containers (sometimes even images) regularly on my desktop, as they take up a lot of space after some time and I use a lot of different ones for testing all kind of stuff. I develop a lot of software inside those containers. When there was an update to some dependencies and jenkins tests show that something is not working anymore, I pull the docker and change the software. By this I collect a lot of containers on my system. On my websevers on the other hand I dont do that of course. Of course you can also run them from start with the rm flag.
    In the gui beneath the docker images there are docker containers, at least at my system. The button where it says start is a dropdown menu. You can stop a container there and on the right there is also a delete button.

    Well that took me by surprise...how can I missed that... Even though I stopped the containers, I never saw the option to delete them at least not until you mention there is a button there. Ok that one is on me. Allowed me to delete afterwards both container and image. Only thing I had to do manually was to delete the config folders manually created for each container and not by the shared folder AppData (Permission problems - ok logical) but through cloud commander for example and now I m ok.


    Run them with the rm = meaning remove? If its to be removed why run it?


    Last you mention in an above post <<To delete an image you need docker rmi <imagename>>> rmi is command like remove image or a number for each docker I have to find from somewhere?

  • rmi means remove image. This is the same you did on the gui now. In general are things to be replaced in <> and optional ones in [] or {} if they are pepeadable. It is called Extended Backus Naur Form.
    The rm flag removes a container (not the image) when it stops.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!