ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Docker Commit

    IT Discussion
    docker container containerization
    3
    12
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AlyRagabA
      AlyRagab
      last edited by scottalanmiller

      Hi All,

      In Docker , there is an issue i have that when i pull an image like the below command

      docker pull centos
      

      then i will be in need to run it to create a Container

      docker run -it centos /bin/bash
      

      the issue here is if i return back to the docker host any changes will not be saved into that container and the solution for that is to use the " docker commit " command
      that command will create another instance of that image again and thus will take another space in the storage

      so is there any advice to solve such thing ?

      Thanks 🙂

      1 Reply Last reply Reply Quote 2
      • AlyRagabA
        AlyRagab
        last edited by

        Is there any advice about this issue ?.

        1 Reply Last reply Reply Quote 0
        • A
          aidan_walsh
          last edited by

          What changes are you talking about? App updates? Data?

          AlyRagabA 1 Reply Last reply Reply Quote 0
          • AlyRagabA
            AlyRagab @aidan_walsh
            last edited by

            @aidan_walsh yes , any command executed or installed packages and so on.

            1 Reply Last reply Reply Quote 0
            • A
              aidan_walsh
              last edited by aidan_walsh

              Docker won't create a new, full image of the container when you run the commit command. It uses union mounted file systems to minimise the overhead. Running commit is probably the best thing for you to do.

              Otherwise, perhaps application data should be stored in a volume?

              AlyRagabA 1 Reply Last reply Reply Quote 0
              • AlyRagabA
                AlyRagab @aidan_walsh
                last edited by

                @aidan_walsh When i logged into the container by

                docker run -it centos /bin/bash
                

                and install the apache , then i logged out
                when i tried to log in again i did not find the apache installed so why ?

                A 1 Reply Last reply Reply Quote 0
                • A
                  aidan_walsh @AlyRagab
                  last edited by

                  @AlyRagab docker run creates a new container and starts it. I think you're looking for the docker start command.

                  AlyRagabA 1 Reply Last reply Reply Quote 0
                  • AlyRagabA
                    AlyRagab @aidan_walsh
                    last edited by

                    @aidan_walsh i think it can be done through

                    docker exec -it CONTAINER_NAME /bin/bash
                    

                    i did it and installed the httpd package and when i exit and return to it again the apache is still installed.

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      aidan_walsh @AlyRagab
                      last edited by

                      @AlyRagab exec runs against a started container.

                      I think I'm not following the flow that you're using. Could you post all the commands you run when you experience the issue?

                      1 Reply Last reply Reply Quote 0
                      • Emad RE
                        Emad R
                        last edited by Emad R

                        @AlyRagab said in Docker Commit:

                        any advice to solve such thing ?
                        Thanks

                        My advice is to manage Docker from web interface UI, their you can see more of what docker is doing, and very helpful for new docker starters.

                        Launch or Install Docker UI on port 9000

                        docker pull uifd/ui-for-docker
                        docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker

                        Then navigate from web browser to http://docker IP:9000

                        Also I think the issue is that when you exit centos, you exit via ctrl-c thus you end the session all together, what you want to do is run the centos as backrgound, and you can connect to it using another ssh client like putty or even from docker via connect:

                        Connect to an running Container

                        docker exec -it Ubuntu_1 bash
                        or
                        docker exec -it 7e153095b94f bash

                        AlyRagabA 1 Reply Last reply Reply Quote 2
                        • AlyRagabA
                          AlyRagab @Emad R
                          last edited by

                          @msff-amman-Itofficer said in Docker Commit:

                          @AlyRagab said in Docker Commit:

                          any advice to solve such thing ?
                          Thanks

                          My advice is to manage Docker from web interface UI, their you can see more of what docker is doing, and very helpful for new docker starters.

                          Launch or Install Docker UI on port 9000

                          docker pull uifd/ui-for-docker
                          docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker

                          Then navigate from web browser to http://docker IP:9000

                          Also I think the issue is that when you exit centos, you exit via ctrl-c thus you end the session all together, what you want to do is run the centos as backrgound, and you can connect to it using another ssh client like putty or even from docker via connect:

                          Connect to an running Container

                          docker exec -it Ubuntu_1 bash
                          or
                          docker exec -it 7e153095b94f bash

                          Yes , i will try test everything the Web UI offers , i am now working with the docker exec command.

                          but another question is do you prefer working with the supervisord or running each process in a separate container ?.

                          Emad RE 1 Reply Last reply Reply Quote 0
                          • Emad RE
                            Emad R @AlyRagab
                            last edited by Emad R

                            @AlyRagab

                            The web UI benefit is that it allowed me to understand why everytime I launch container it spawned a new one and made new generic name for it, and helped me understand more visually.

                            However You can do much more from it, than stop/start/restart/commit containers, and monitoring them. When it comes to doing edits its advised you do everything from command.

                            I actually never heard of supervisord until you mentioned it, thus I ran the default which I reckon is each process in a separate container and never had any issues yet.

                            For me the important thing I learned exploring docker is distinction between application containers and OS containers, and how to approach each.

                            Since you mentioned centos in docker, you might want to check Alpine Linux images, cause they fit the Just enough OS ideology of docker (or was that VMware Photon).

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post