0

I am new to Docker and tried to check how to make changes in a docker container and commit them to reflect in the results. I have AWX running on Docker-CE and had created made changes in awx_web container to update the UI logo as mentioned in the Ansible Tower documentation:

docker cp custom_console_logo.png aea2551951d5:/var/lib/awx/public/static/assets

and created the local_settings.json in /var/lib/awx/public/static/ one of the running awx_web container using the following and then using the bash command to create and save file:

docker exec -it aea2551951d5 bash

Post this, i have commited the changes so that the changes are reflected permanently in the image file and in UI using:

docker commit aea2551951d5 ansible/awx_web

I have verified the changes in the container files and it appears to be fine however, the changes are not getting reflected when i verified them on browser. It appears like the existing container is pointing to the old image file:

CONTAINER ID        IMAGE
aea2551951d5        b7c261b76010

I am not sure what was missed. Could anyone suggest if i have missed anything and how do i fix this?

Following are the containers:

[root@localhost~]# docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                                 NAMES
80ab6bf562a9        ansible/awx_task:latest      "/tini -- /bin/sh -c…"   13 days ago         Up 3 days           8052/tcp                                              awx_task
aea2551951d5        b7c261b76010                 "/tini -- /bin/sh -c…"   13 days ago         Up 3 hours          0.0.0.0:80->8052/tcp                                  awx_web
e789a4a82a9e        memcached:alpine             "docker-entrypoint.s…"   13 days ago         Up 3 days           11211/tcp                                             memcached
a8c74584255c        ansible/awx_rabbitmq:3.7.4   "docker-entrypoint.s…"   13 days ago         Up 3 days           4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp   rabbitmq
25f6f6ca7766        postgres:9.6                 "docker-entrypoint.s…"   13 days ago         Up 3 days           5432/tcp                                              postgres

Following are the Images:

[root@localhost~]# docker image ls
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
ansible/awx_web        latest              1accc59cbdee        2 hours ago         1.06GB
b7c261b76010           latest              998ec3e77fd8        3 hours ago         1.06GB
postgres               9.6                 106bdfb062df        6 weeks ago         235MB
ansible/awx_task       latest              535bb2b8e1f3        6 weeks ago         1.07GB
ansible/awx_web        <none>              b7c261b76010        6 weeks ago         1.04GB
hello-world            latest              2cb0d9787c4d        2 months ago        1.85kB
memcached              alpine              b40e8fa7e3e5        2 months ago        8.69MB
ansible/awx_rabbitmq   3.7.4               e08fe791079e        5 months ago        85.6MB
[root@clab2726vw0001 ~]#

Environment Information:

Docker Version: 18.06.0-ce, build 0ffa825
AWX Version: 1.0.6.41
Ansible Version: 2.6.1
RHEL Version: Red Hat Enterprise Linux Server release 7.5 (Maipo)
Ankit Vashistha
  • 325
  • 6
  • 17

1 Answers1

1

Containers are the running instances of images and the container id is unique for the particular image.
We cannot use the same 12 digit container id as a reference for the other images. When we use "commit" it create a new fresh container for the new image.

This new container will contain all the changes needed.

You can try with naming the container.

  1. Give a name to container (using docker rename command) .
  2. Make your changes in container.
  3. Commit it.
  4. Give same name to new container generated for the new image.
  5. Rename old container with some other name.

Now you have the same container name (as you were using before) but with new Image.