1

I have followed this answer(Duplicating docker container for debugging), but even when executing 1st line of code:

docker run -it <base_image> /bin/bash

I got such error: docker: Error response from daemon: Not found. See 'docker run --help'.

I guess code above is to create new container based on existing image. Then following 2 lines of code:

yum install ping 
docker commit <hash tag of running container> new_image

They install ping tool to that new container and then export it as a new image.

Please correct me if my previous understand is not true.

But for me, after cloning magento/maraidb container, I still want them to use the same images file. (just change some config in {{.Config.Env}}

-------- UPDATE: -- Now I don't mind if save changes to new images and create container on top of new containers ----------------

I follow your suggestion and did make sure docker daemon is running. I also did pull first via:

docker pull bitnami/mariadb:latest
docker pull bitnami/magento:latest

As I still need to export all these changes in containers to new images, I did that:

docker commit {container A}bitnami/mariadb:newname
docker commit {container B} bitnami/magento:newname

Then if I use the new image for 'Docker run....', I got this error:

 INFO  ==> Starting mysqld_safe...
mariadb_1 | Could not open required defaults file: /opt/bitnami/mariadb/conf/my.cnf
mariadb_1 | Fatal error in defaults handling. Program aborted
mariadb_1 | WARNING: Defaults file '/opt/bitnami/mariadb/conf/my.cnf' not found!
mariadb_1 | Could not open required defaults file: /opt/bitnami/mariadb/conf/my.cnf
mariadb_1 | Fatal error in defaults handling. Program aborted
mariadb_1 | WARNING: Defaults file '/opt/bitnami/mariadb/conf/my.cnf' not found!
mariadb_1 | 170330 00:04:40 mysqld_safe Logging to '/opt/bitnami/mariadb/data/4bdcd2db9267.err'.
mariadb_1 | 170330 00:04:40 mysqld_safe Starting mysqld daemon with databases from /opt/bitnami/mariadb/data
mariadb_1 | /opt/bitnami/mariadb/bin/mysqld_safe_helper: Can't create/write to file '/opt/bitnami/mariadb/data/4bdcd2db9267.err' (Errcode: 2 "No such file or directory")

-------- UPDATE2: -- Maybe previously I might haven't said clearly. Here are my steps:----------------

1, Use docker-compose and docker-compose.yml to create 1 Magento & MariaDB container. The images are: magento:latest and mariadb:latest

2, Then I login to Magento and made few system changes. What I want next is to create/export/commit current container to new images, e.g. call them magento:sam and mariadb:sam. The command I use is: docker commit {container id} magento:sam.

3, Before previous step, I also used: docker pull magento:latest (I follow other people's suggestion as they said some data might not store in container and needs to pull first ----- If it's wrong, please point out.)

4, After new image created, then I use: docker -ti -p 81:81 magento:sam try to create new container based on new image. But get message and error message as:

Welcome to the magento image ***
Brought to you by Bitnami ***
More information: https://github.com/bitnami/bitnami-docker-magento ***
Issues: https://github.com/bitnami/bitnami-docker-magento/issues ***

New version available: run docker pull bitnami/magento:2.1.5-r2 to update. ***

**nami ERROR Unable to start com.bitnami.apache: httpd: Could not open configuration file /opt/bitnami/apache/conf/httpd.conf: No such file or directory**

Please help which step is wrong or missing any steps. Thanks again!

Community
  • 1
  • 1
Samuel
  • 631
  • 1
  • 10
  • 26
  • Docker daemon is up? try this `sudo service docker status` if docker daemon ins't up put it in up with `sudo service docker start` and then you try `docker run` – julian salas Mar 28 '17 at 04:34
  • Hi Julian, it shows: docker start/running, process 985. (After I export DOCKER_HOST=:2375). So shall I run docker commit there?) – Samuel Mar 29 '17 at 01:57
  • Could you update post with image docker for that container? I guess that `nameimage:tag` for example `python:3-onbuild` – julian salas Mar 29 '17 at 02:00
  • Hi Julian, please see my update – Samuel Mar 30 '17 at 00:44

1 Answers1

0

As seen here, that means docker is looking for your base image, but does not find it.

Check how your docker daemon is launched, and make sure that the base image you want to clone is docker pull first (in your local registry).
Of course, do replace <base_image> by the right image name.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi VonC, sorry to ask a basic question: when you talk about , does that mean image name + tag? (e.g. bitnami/magento:2.1.3-r1) – Samuel Mar 29 '17 at 01:56
  • @Samuel Yes, although generally the image name is often enough (it picks the one you would have pulled into your local registry) – VonC Mar 29 '17 at 04:38
  • @Samuel before docker commit, you did a docker run? What was the exact docker run command you used? – VonC Mar 30 '17 at 04:37
  • Hi VonC, I use: docker run -ti -p 81:81 {new image name}。But I call 'docker run' after 'docker commit' as I need to run to create a new container based on new image. – Samuel Mar 30 '17 at 07:43
  • @Samuel "new image name"? You are suppose ti use a new image name when committnig, to save the container as a new image. But you should first docker run an existing image name (that you previously pulled) – VonC Mar 30 '17 at 07:45
  • Should I pull first then commit (to generate a new image based on latest container) and then run?(to create a new container from that new image) – Samuel Mar 30 '17 at 07:48
  • @Sam no, pull, run, commit – VonC Mar 30 '17 at 09:30
  • Hi @VonC, maybe I didn't tell you clearly. Please see my update2 and let me know if any steps are wrong or in wrong order. Thanks a lot again!! – Samuel Mar 30 '17 at 13:47
  • @Samuel OK. Some data must has been written in a volume that your second docker run did not use. – VonC Mar 30 '17 at 14:02
  • Hi @VonC, does that mean 'docker commit' is not suitable for my case? In the yml file I set volume to be 'local'. In other words, how to make sure ALL contents of a container be 'exported' to a new image? And if there is any other normal way to [clone a container], please let me know :) Thanks a lot again!! – Samuel Mar 30 '17 at 14:17
  • @Samuel you just need to reuse the same volume (either host bind-mounted volumes or data volume container) as the ones used in your first docker run – VonC Mar 30 '17 at 14:26
  • Hi @VonC, actually I did. For example I create another yml file with the same volume value and with different port of course. But get above error. So what shall I in your way? Pass volume in the "docker run" command? – Samuel Mar 30 '17 at 20:20
  • @Samuel I think "creating another yml" means it will define a *new* volume within the image: that will override the one committed. It is best to use the first and second image with the *same* data volume container (ie a dedicated volume reused in both docker run). See https://docs.docker.com/engine/tutorials/dockervolumes/#creating-and-mounting-a-data-volume-container – VonC Mar 30 '17 at 20:23
  • Hi @VonC, but I did want to create new container based on new image rather than the old image. – Samuel Mar 30 '17 at 22:53