# Volumes do not work when Dockerfile is taken from non current folder

**URL:** <https://community.okteto.com/t/volumes-do-not-work-when-dockerfile-is-taken-from-non-current-folder/482>\
**Category:** Not sure?\
**Created:** [December 22, 2022, 12:29pm UTC](https://community.okteto.com/t/volumes-do-not-work-when-dockerfile-is-taken-from-non-current-folder/482 "2022-12-22T12:29:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shipitsin-ilia](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/shipitsin-ilia/32/179_2.png) [@shipitsin-ilia](https://community.okteto.com/u/shipitsin-ilia)\
**Post date:** [December 22, 2022, 12:29pm UTC](https://community.okteto.com/t/volumes-do-not-work-when-dockerfile-is-taken-from-non-current-folder/482/1 "2022-12-22T12:29:38Z")

</div>

docker-compose.yml

```auto
version: '3.8'
services:
  mysql:
    build: ./docker/mysql-data
    container_name: mysql_hellcase
    restart: always
    cap_add:
      - SYS_NICE
    volumes:
      - ./docker/mysql-data/sql:/docker-entrypoint-initdb.d/
      - ./docker/mysql:/var/lib/mysql
      - ./docker/mysql-data/mysqld.cnf:/etc/mysql/my.cnf
    environment:
      - 'MYSQL_DATABASE=dev'
      - 'MYSQL_ROOT_PASSWORD=root'
    ports:
      - "3306:3306"

```

okteto stack deploy --build

```auto
 ! 'okteto stack deploy' is deprecated in favor of 'okteto deploy', and will be removed in a future version
 i Using shipitsin-ilia @ cloud.okteto.com as context
 i Building image for service 'mysql'
 i Building the image 'okteto.dev/head-mysql:okteto' in tcp://buildkit.cloud.okteto.net:443...
[+] Building 80.4s (7/7) FINISHED
 => [internal] load build definition from buildkit-430320183 0.6s
 => => transferring dockerfile: 179B 0.5s
 => [internal] load .dockerignore 0.4s
 => => transferring context: 2B 0.4s
 => [internal] load metadata for docker.io/percona/percona-server:latest 1.1s
 => [1/3] FROM docker.io/percona/percona-server:latest@sha256:3c0c81efaac2fc959744ff5ebada8a40577f4ef9e0ceadc1fcf1ef11d04a0f57 0.0s
 => => resolve docker.io/percona/percona-server:latest@sha256:3c0c81efaac2fc959744ff5ebada8a40577f4ef9e0ceadc1fcf1ef11d04a0f57 0.0s
 => => sha256:d41aca7eaf39d49968d7dc7bb89fd025c1437e47707116f04aec24be71fa5838 3.09kB / 3.09kB 0.1s
 => => sha256:de4b425f679998a9424f365ea2afa62ac3b748d9103286667427d4b68969b659 1.16kB / 1.16kB 0.1s
 => => sha256:4a9e09d40229ded27350f07e893745c7ec96d6b472a3013f5c76ae78e2f5e9a7 182.64MB / 182.64MB 4.4s
 => => sha256:f9ade38d555e562e1d7a1da68dd56e6018a61f442f6c991c07ab39f38720a4e8 161.76MB / 161.76MB 3.0s
 => => sha256:b4887fd6be4e3c4d7f1454e460af28616a6975acec6138f1675630aa04996d32 1.17kB / 1.17kB 0.1s
 => => sha256:c6c66e8d29aad4dd795924af44e2653db9c88e70d8d5ffc158e799eef5984c4f 84.89MB / 84.89MB 1.6s
 => => extracting sha256:c6c66e8d29aad4dd795924af44e2653db9c88e70d8d5ffc158e799eef5984c4f 2.5s
 => => extracting sha256:b4887fd6be4e3c4d7f1454e460af28616a6975acec6138f1675630aa04996d32 2.0s
 => => extracting sha256:f9ade38d555e562e1d7a1da68dd56e6018a61f442f6c991c07ab39f38720a4e8 3.0s
 => => extracting sha256:4a9e09d40229ded27350f07e893745c7ec96d6b472a3013f5c76ae78e2f5e9a7 10.3s
 => => extracting sha256:de4b425f679998a9424f365ea2afa62ac3b748d9103286667427d4b68969b659 0.0s
 => => extracting sha256:d41aca7eaf39d49968d7dc7bb89fd025c1437e47707116f04aec24be71fa5838 0.0s
 => [2/3] RUN percona-release enable tools release 0.5s
 => [3/3] RUN dnf install -y percona-toolkit 37.4s
 => exporting to image 18.1s
 => => exporting layers 11.2s
 => => exporting manifest sha256:d524a6aba5ca91368e94c299bf3ef2edb4b3936827cb87132a8d1ecbab8a7a8a 0.0s
 => => exporting config sha256:5d85aa509e6f84e7a393ec02cfe802ebc11caa4796c636c465bf6bd44e4ca62b 0.0s
 => => pushing layers 6.2s
 => => pushing manifest for registry.cloud.okteto.net/shipitsin-ilia/head-mysql:okteto@sha256:d524a6aba5ca91368e94c299bf3ef2edb4b3936827cb87132a8 0.6s
 ✓ Image 'registry.cloud.okteto.net/shipitsin-ilia/head-mysql:okteto' successfully pushed
 i Including volume hosts for service 'mysql'
 i Building the image 'okteto.dev/head-mysql:okteto-with-volume-mounts' in tcp://buildkit.cloud.okteto.net:443...
[+] Building 1.9s (8/8) FINISHED
 => [internal] load .dockerignore 0.6s
 => => transferring context: 185B 0.5s
 => [internal] load build definition from buildkit-4084751714 0.6s
 => => transferring dockerfile: 318B 0.6s
 => [internal] load metadata for registry.cloud.okteto.net/shipitsin-ilia/head-mysql@sha256:d524a6aba5ca91368e94c299bf3ef2edb4b3936827cb87132a8d1 0.7s
 => [1/4] FROM registry.cloud.okteto.net/shipitsin-ilia/head-mysql@sha256:d524a6aba5ca91368e94c299bf3ef2edb4b3936827cb87132a8d1ecbab8a7a8a 0.1s
 => => resolve registry.cloud.okteto.net/shipitsin-ilia/head-mysql@sha256:d524a6aba5ca91368e94c299bf3ef2edb4b3936827cb87132a8d1ecbab8a7a8a 0.0s
 => [internal] load build context 0.4s
 => => transferring context: 28B 0.4s
 => ERROR [2/4] COPY docker/mysql-data/sql /docker-entrypoint-initdb.d/ 0.0s
 => ERROR [3/4] COPY docker/mysql /var/lib/mysql 0.0s
 => ERROR [4/4] COPY docker/mysql-data/mysqld.cnf /etc/mysql/my.cnf 0.0s
------
 > [2/4] COPY docker/mysql-data/sql /docker-entrypoint-initdb.d/:
------
------
 > [3/4] COPY docker/mysql /var/lib/mysql:
------
------
 > [4/4] COPY docker/mysql-data/mysqld.cnf /etc/mysql/my.cnf:
------
 x Error building image 'registry.cloud.okteto.net/shipitsin-ilia/head-mysql:okteto-with-volume-mounts': build failed: failed to solve: failed to compute cache key: failed to calculate checksum of ref uki3r6uu4fgl6qit2f44irchc::vo13zx9wi3jfeakwii0pqzyfp: "/docker/mysql-data/mysqld.cnf": not found

```

---

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/ramiro/32/6_2.png) [@ramiro](https://community.okteto.com/u/ramiro)\
**Post date:** [December 23, 2022, 2:58am UTC](https://community.okteto.com/t/volumes-do-not-work-when-dockerfile-is-taken-from-non-current-folder/482/2 "2022-12-23T02:58:51Z")

</div>

> [@shipitsin-ilia](#):
>
> `x Error building image 'registry.cloud.okteto.net/shipitsin-ilia/head-mysql:okteto-with-volume-mounts': build failed: failed to solve: failed to compute cache key: failed to calculate checksum of ref uki3r6uu4fgl6qit2f44irchc::vo13zx9wi3jfeakwii0pqzyfp: "/docker/mysql-data/mysqld.cnf": not found`

This error typically means that there isn’t a file in the path `docker/mysql-data/mysqld.cnf` of your local machine. Can you double-check that the file `docker/mysql-data/mysqld.cnf` exists?

---

<div class="post-metadata">

**Author:** ![nitishMehrotra](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/nitishmehrotra/32/404_2.png) [@nitishMehrotra](https://community.okteto.com/u/nitishMehrotra)\
**Post date:** [June 7, 2023, 9:12am UTC](https://community.okteto.com/t/volumes-do-not-work-when-dockerfile-is-taken-from-non-current-folder/482/3 "2023-06-07T09:12:33Z")

</div>

I am also facing a similar problem. The file is there, but okteto is unable to pick the relative path.
