Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Error: Cannot create container for service, no such file or dir

I'm trying to install CKAN via docker-compose: http://docs.ckan.org/en/2.8/maintaining/installing/install-from-docker-compose.html

If I try to build with:

docker-compose up -d --build

I keep getting:

ERROR: for db  Cannot create container for service db: no such file or directory
ERROR: compose.cli.main.main: Encountered errors while bringing up the project.

With the verbose flag I get:

compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- (u'docker_db')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/images/docker_db/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
 u'Author': u'Open Knowledge',
 u'Comment': u'',
 u'Config': {u'ArgsEscaped': True,
             u'AttachStderr': False,
             u'AttachStdin': False,
             u'AttachStdout': False,
             u'Cmd': [u'postgres'],
             u'Domainname': u'',
             u'Entrypoint': [u'docker-entrypoint.sh'],
...
compose.service.build_container_labels: Added config hash: dfb16feda9d1de6f3a84b0a6e1ecee1a8d041d06d5676351f8f723b05c4f6f03
compose.cli.verbose_proxy.proxy_callable: docker create_host_config <- (device_read_iops=None, mem_swappiness=None, links=[], oom_score_adj=None, blkio_weight=None, cpu_count=None, cpuset_cpus=None, dns_search=None, pid_mode=None, init_path=None, log_config={'Type': u'', 'Config': {}}, cpu_quota=None, read_only=None, cpu_percent=None, device_read_bps=None, storage_opt=None, init=None, dns=None, volumes_from=[], ipc_mode=None, mem_reservation=None, security_opt=None, shm_size=None, device_write_iops=None, dns_opt=None, cgroup_parent=None, group_add=None, network_mode=u'docker_default', volume_driver=None, oom_kill_disable=None, userns_mode=None, tmpfs=[], nano_cpus=None, port_bindings={}, isolation=None, memswap_limit=None, restart_policy=None, blkio_weight_device=None, devices=None, extra_hosts=None, binds=[u'docker_pg_data:/var/lib/postgresql/data:rw'], sysctls=None, pids_limit=None, device_write_bps=None, cap_add=None, mounts=None, mem_limit=None, runtime=None, cap_drop=None, privileged=False, ulimits=None, cpu_shares=None)
compose.cli.verbose_proxy.proxy_callable: docker create_host_config -> {'Binds': [u'docker_pg_data:/var/lib/postgresql/data:rw'],
 'Links': [],
 'LogConfig': {'Config': {}, 'Type': u''},
 'NetworkMode': u'docker_default',
 'PortBindings': {},
 'VolumesFrom': []}
compose.cli.verbose_proxy.proxy_callable: docker create_container <- (name='db', image=u'docker_db', labels={u'com.docker.compose.service': u'db', u'com.docker.compose.project': u'docker', u'com.docker.compose.config-hash': 'dfb16feda9d1de6f3a84b0a6e1ecee1a8d041d06d5676351f8f723b05c4f6f03', u'com.docker.compose.version': u'1.19.0', u'com.docker.compose.oneoff': u'False', u'com.docker.compose.container-number': '1'}, host_config={'NetworkMode': u'docker_default', 'Links': [], 'PortBindings': {}, 'Binds': [u'docker_pg_data:/var/lib/postgresql/data:rw'], 'LogConfig': {'Type': u'', 'Config': {}}, 'VolumesFrom': []}, environment=[u'POSTGRES_PASSWORD=uuimwc', u'DS_RO_PASS=uuimwc'], volumes={u'/var/lib/postgresql/data': {}}, detach=True, networking_config={u'EndpointsConfig': {u'docker_default': {u'IPAMConfig': {}, u'Aliases': ['db']}}})
compose.parallel.feed_queue: Pending: set([<Service: ckan>])
compose.parallel.feed_queue: Pending: set([])
Creating db ... error
compose.parallel.feed_queue: Pending: set([])
compose.parallel.feed_queue: Pending: set([])
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/containers/create?name=db HTTP/1.1" 500 40
compose.parallel.parallel_execute_iter: Failed: ServiceName(project=u'docker', service='db', number=1)
compose.parallel.feed_queue: Pending: set([])

ERROR: for db  Cannot create container for service db: no such file or directory
compose.parallel.parallel_execute_iter: Failed: <Service: db>
compose.parallel.feed_queue: Pending: set([<Service: ckan>])
compose.parallel.feed_queue: <Service: ckan> has upstream errors - not processing
compose.parallel.parallel_execute_iter: Failed: <Service: ckan>

Can anyone tell me how to find out what causes this? The errors are not really meaningful it seems, how can I find out what file or directory it is missing?

like image 852
chbla Avatar asked Aug 13 '18 07:08

chbla


2 Answers

i had the same issue when i deleted the directory manually

rm -fr /var/lib/docker/volumes/[your_volume]

The solution for me was to delete the volume in docker First list the existing volume

docker volume ls

find the one you want to delete then

docker volume rm [your_volume]

Then i was able to do the docker-compose

like image 126
triton oidc Avatar answered Oct 24 '22 03:10

triton oidc


try :

docker volume prune

docker system prune

it works for me after deleting volume from : /var/lib/docker/volumes/[MY-VOLUME]

like image 15
Khalil Meg Avatar answered Oct 24 '22 04:10

Khalil Meg