Code Monkey home page Code Monkey logo

Comments (10)

gdraheim avatar gdraheim commented on September 25, 2024

Sorry, this bug report did slip through .... can you specify the docker-copyedit.py version (at the top of the file).

Additionally, it seems that the cli parser is not correct, as "remove all ports" should be translated into "("remove", "ports", "all"). You can check that by adding a --dryrun option.

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024

By the way, there are testcases that match that syntax, so it should actually work.

    cmd = "./docker-copyedit.py FROM {img}:{testname} INTO {img}:{testname}x remove all volumes -vv"

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024

I think that I have found it - in one place "all" had been matched only in lower()-case format.

v1.2.1401 should work now as expected.

from docker-copyedit.

chpock avatar chpock commented on September 25, 2024

Thank you for the fix, but the command from the readme still doesn't work.

$ grep _version_ ./docker-copyedit.py
__version__ = "1.2.1402"
$ ./docker-copyedit.py FROM mysql:5.6 INTO mysql-novolx:5.6 -vv REMOVE ALL VOLUMES
INFO:edit:  unchanged load.tmp/data/1f47fade220d0ddedb916156cf4d7121a020afff03c19b4638ac494c5d1eca63.json
WARNING:edit:unchanged image from mysql:5.6
WARNING:edit: tagged old image as mysql-novolx:5.6
$ docker inspect mysql-novolx:5.6 | grep -A2 Volumes
            "Volumes": {
                "/var/lib/mysql": {}
            },
--
            "Volumes": {
                "/var/lib/mysql": {}
            },

But this command works:

$ ./docker-copyedit.py FROM mysql:5.6 INTO mysql-novolx:5.6 -vv REMOVE VOLUMES '*'
WARNING:edit:done actual config remove volumes '*'
WARNING:edit:done actual config remove volumes '*'
INFO:edit:written new load.tmp/data/9e04f40e78419e6da01340cc0858b2531552fadda9274ea72f85dd3c0e004674.json
INFO:edit:removed old load.tmp/data/1f47fade220d0ddedb916156cf4d7121a020afff03c19b4638ac494c5d1eca63.json
$ docker inspect mysql-novolx:5.6 | grep -A2 Volumes
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
--
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024

I have created a testcase for this specific case - test_304

The actual bug had been in the parser that should have provided "VOLUMES" converted to lowercase for the edit_image to work on.

It should be fixed by now.

from docker-copyedit.

GMartinez-Sisti avatar GMartinez-Sisti commented on September 25, 2024

@gdraheim It's working now, the volumes are being removed, although docker history still shows the layer info. This makes it really hard to detect if the volumes were actually removed.

Example:

→ cat ./docker-copyedit.py | grep __version__
__version__ = "1.2.2036"
→ ./docker-copyedit.py -vvv FROM confluentinc/cp-kafka:5.0.0 INTO confluentinc/cp-kafka:5.0.0_2 rm all volumes
DEBUG:edit:image parsing = confluentinc/cp-kafka:5.0.0
DEBUG:edit:.registry = None
DEBUG:edit:.image = confluentinc/cp-kafka
DEBUG:edit:.version = :5.0.0
DEBUG:edit:image parsing = confluentinc/cp-kafka:5.0.0_2
DEBUG:edit:.registry = None
DEBUG:edit:.image = confluentinc/cp-kafka
DEBUG:edit:.version = :5.0.0_2
DEBUG:edit:mkdir load.tmp/data
DEBUG:edit:total 559040
drwxr-xr-x 10 user staff       320 Jan 28 15:23 data
-rw-------  1 user staff 570451456 Jan 28 15:23 saved.tar

DEBUG:edit:with config: {u'Tty': False, u'Cmd': [u'/etc/confluent/docker/run'], u'Volumes': {u'/etc/kafka/secrets': {}, u'/var/lib/kafka/data': {}}, u'Domainname': u'', u'WorkingDir': u'', u'Image': u'sha256:12b00fa9494638f9e1df99186358973e5244aeb966f619b5222ac1c4aa717a55', u'Hostname': u'', u'StdinOnce': False, u'ArgsEscaped': True, u'Labels': {u'io.confluent.docker.build.number': u'None', u'io.confluent.docker.git.id': u'50e0fc1', u'io.confluent.docker': u'true'}, u'AttachStdin': False, u'User': u'', u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', u'ALLOW_UNSIGNED=false', u'PYTHON_VERSION=2.7.9-1', u'PYTHON_PIP_VERSION=8.1.2', u'SCALA_VERSION=2.11', u'KAFKA_VERSION=2.0.0', u'CONFLUENT_MAJOR_VERSION=5', u'CONFLUENT_MINOR_VERSION=0', u'CONFLUENT_PATCH_VERSION=0', u'CONFLUENT_MVN_LABEL=', u'CONFLUENT_PLATFORM_LABEL=', u'CONFLUENT_VERSION=5.0.0', u'CONFLUENT_DEB_VERSION=1', u'ZULU_OPENJDK_VERSION=8=8.30.0.1', u'LANG=C.UTF-8', u'CUB_CLASSPATH=/etc/confluent/docker/docker-utils.jar', u'KAFKA_ZOOKEEPER_CONNECT=', u'KAFKA_ADVERTISED_LISTENERS=', u'COMPONENT=kafka'], u'ExposedPorts': {u'9092/tcp': {}}, u'OnBuild': None, u'AttachStderr': False, u'Entrypoint': None, u'AttachStdout': False, u'OpenStdin': False}
WARNING:edit:done actual config rm volumes '*'
DEBUG:edit:done config: {u'Tty': False, u'Cmd': [u'/etc/confluent/docker/run'], u'Domainname': u'', u'WorkingDir': u'', u'Image': u'sha256:12b00fa9494638f9e1df99186358973e5244aeb966f619b5222ac1c4aa717a55', u'Hostname': u'', u'StdinOnce': False, u'ArgsEscaped': True, u'Labels': {u'io.confluent.docker.build.number': u'None', u'io.confluent.docker.git.id': u'50e0fc1', u'io.confluent.docker': u'true'}, u'AttachStdin': False, u'User': u'', u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', u'ALLOW_UNSIGNED=false', u'PYTHON_VERSION=2.7.9-1', u'PYTHON_PIP_VERSION=8.1.2', u'SCALA_VERSION=2.11', u'KAFKA_VERSION=2.0.0', u'CONFLUENT_MAJOR_VERSION=5', u'CONFLUENT_MINOR_VERSION=0', u'CONFLUENT_PATCH_VERSION=0', u'CONFLUENT_MVN_LABEL=', u'CONFLUENT_PLATFORM_LABEL=', u'CONFLUENT_VERSION=5.0.0', u'CONFLUENT_DEB_VERSION=1', u'ZULU_OPENJDK_VERSION=8=8.30.0.1', u'LANG=C.UTF-8', u'CUB_CLASSPATH=/etc/confluent/docker/docker-utils.jar', u'KAFKA_ZOOKEEPER_CONNECT=', u'KAFKA_ADVERTISED_LISTENERS=', u'COMPONENT=kafka'], u'ExposedPorts': {u'9092/tcp': {}}, u'OnBuild': None, u'AttachStderr': False, u'Entrypoint': None, u'AttachStdout': False, u'OpenStdin': False}
DEBUG:edit:no section 'Config' in config
DEBUG:edit:with container_config: {u'Tty': False, u'Cmd': [u'/bin/sh', u'-c', u'#(nop) ', u'CMD ["/etc/confluent/docker/run"]'], u'Volumes': {u'/etc/kafka/secrets': {}, u'/var/lib/kafka/data': {}}, u'Domainname': u'', u'WorkingDir': u'', u'Image': u'sha256:12b00fa9494638f9e1df99186358973e5244aeb966f619b5222ac1c4aa717a55', u'Hostname': u'24dbf2dfdcbe', u'StdinOnce': False, u'ArgsEscaped': True, u'Labels': {u'io.confluent.docker.build.number': u'None', u'io.confluent.docker.git.id': u'50e0fc1', u'io.confluent.docker': u'true'}, u'AttachStdin': False, u'User': u'', u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', u'ALLOW_UNSIGNED=false', u'PYTHON_VERSION=2.7.9-1', u'PYTHON_PIP_VERSION=8.1.2', u'SCALA_VERSION=2.11', u'KAFKA_VERSION=2.0.0', u'CONFLUENT_MAJOR_VERSION=5', u'CONFLUENT_MINOR_VERSION=0', u'CONFLUENT_PATCH_VERSION=0', u'CONFLUENT_MVN_LABEL=', u'CONFLUENT_PLATFORM_LABEL=', u'CONFLUENT_VERSION=5.0.0', u'CONFLUENT_DEB_VERSION=1', u'ZULU_OPENJDK_VERSION=8=8.30.0.1', u'LANG=C.UTF-8', u'CUB_CLASSPATH=/etc/confluent/docker/docker-utils.jar', u'KAFKA_ZOOKEEPER_CONNECT=', u'KAFKA_ADVERTISED_LISTENERS=', u'COMPONENT=kafka'], u'ExposedPorts': {u'9092/tcp': {}}, u'OnBuild': None, u'AttachStderr': False, u'Entrypoint': None, u'AttachStdout': False, u'OpenStdin': False}
WARNING:edit:done actual config rm volumes '*'
DEBUG:edit:done container_config: {u'Tty': False, u'Cmd': [u'/bin/sh', u'-c', u'#(nop) ', u'CMD ["/etc/confluent/docker/run"]'], u'Domainname': u'', u'WorkingDir': u'', u'Image': u'sha256:12b00fa9494638f9e1df99186358973e5244aeb966f619b5222ac1c4aa717a55', u'Hostname': u'24dbf2dfdcbe', u'StdinOnce': False, u'ArgsEscaped': True, u'Labels': {u'io.confluent.docker.build.number': u'None', u'io.confluent.docker.git.id': u'50e0fc1', u'io.confluent.docker': u'true'}, u'AttachStdin': False, u'User': u'', u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', u'ALLOW_UNSIGNED=false', u'PYTHON_VERSION=2.7.9-1', u'PYTHON_PIP_VERSION=8.1.2', u'SCALA_VERSION=2.11', u'KAFKA_VERSION=2.0.0', u'CONFLUENT_MAJOR_VERSION=5', u'CONFLUENT_MINOR_VERSION=0', u'CONFLUENT_PATCH_VERSION=0', u'CONFLUENT_MVN_LABEL=', u'CONFLUENT_PLATFORM_LABEL=', u'CONFLUENT_VERSION=5.0.0', u'CONFLUENT_DEB_VERSION=1', u'ZULU_OPENJDK_VERSION=8=8.30.0.1', u'LANG=C.UTF-8', u'CUB_CLASSPATH=/etc/confluent/docker/docker-utils.jar', u'KAFKA_ZOOKEEPER_CONNECT=', u'KAFKA_ADVERTISED_LISTENERS=', u'COMPONENT=kafka'], u'ExposedPorts': {u'9092/tcp': {}}, u'OnBuild': None, u'AttachStderr': False, u'Entrypoint': None, u'AttachStdout': False, u'OpenStdin': False}
INFO:edit:written new load.tmp/data/54441bede5d574ac91dfa4b4275f6b0006a9cace34c0f5fcd2a4184320809d90.json
INFO:edit:removed old load.tmp/data/373a4e31e02e8feb03405ebd4fc39df3eadc48390078f9365d17b196de2dd603.json
DEBUG:edit:replaced
	 old load.tmp/data/373a4e31e02e8feb03405ebd4fc39df3eadc48390078f9365d17b196de2dd603.json
	 new load.tmp/data/54441bede5d574ac91dfa4b4275f6b0006a9cace34c0f5fcd2a4184320809d90.json
DEBUG:edit:updated
	 --> load.tmp/data/manifest.json
DEBUG:edit:changed 1 layer metadata
→ docker history confluentinc/cp-kafka:5.0.0_2
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
54441bede5d5        5 months ago        /bin/sh -c #(nop)  CMD ["/etc/confluent/dock…   0B
<missing>           5 months ago        /bin/sh -c #(nop) COPY dir:b0f94e266a302c292…   10.3kB
<missing>           5 months ago        /bin/sh -c #(nop)  VOLUME [/var/lib/kafka/da…   0B
<missing>           5 months ago        |2 BUILD_NUMBER=None COMMIT_ID=50e0fc1 /bin/…   66.2MB
[...]

Not sure if this is a bug, or a request. :)

Regards

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024

Well, I am not sure if this is a bug or request, either. Actually, the docker-copyedit.py script does not change the layer content, on the other I have chosen to create a new layer name to differeniate the output from the input data. So it may be a good idea to update the timestamp as well to make the modified docker image stand out.

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024
> docker history mysql-test_304:5.6
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
ee7a85c20cb1        5 minutes ago       docker-copyedit.py  #(1.3.2045)                 0B                  
<missing>           8 days ago          /bin/sh -c #(nop)  CMD ["mysqld"]               0B                  
<missing>           8 days ago          /bin/sh -c #(nop)  EXPOSE 3306                  0B                  
<missing>           8 days ago          /bin/sh -c #(nop)  ENTRYPOINT ["docker-entry…   0B                  
<missing>           8 days ago          /bin/sh -c ln -s usr/local/bin/docker-entryp…   34B                 

how about this? ;)

from docker-copyedit.

GMartinez-Sisti avatar GMartinez-Sisti commented on September 25, 2024

@gdraheim That's better :) Let me try it.

from docker-copyedit.

gdraheim avatar gdraheim commented on September 25, 2024

... assuming fixed.

from docker-copyedit.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.