diff --git a/tow/commands/build.py b/tow/commands/build.py
index f072ae0..9343554 100644
--- a/tow/commands/build.py
+++ b/tow/commands/build.py
@@ -31,11 +31,17 @@ class BuildCommand(Command):
         #  Check if you would like to patch Dockerfile in order to use
         #  reconfiguration on run phase
         if namespace.tow_run:
+            command = []
             (entrypoint, cmd) = dockerfile.find_entrypoint_or_cmd()
+            if cmd:
+                command += cmd
+            if entrypoint:
+                command = entrypoint + command
+                command.append("$@")
             templates.process_template("tow.sh.tmpl",
                                        os.path.join(workingdir, "tow.sh"),
-                                       {"entrypoint": entrypoint,
-                                        "cmd": cmd, "mapping": file_mapping,
+                                       {"command": command,
+                                        "mapping": file_mapping,
                                         "volume_name": TOW_VOLUME})
             file_mapping.append(("tow.sh", "/tow.sh", 755))
             dockerfile.replace_entrypoint_or_cmd_by_tow_cmd("sh /tow.sh")
diff --git a/tow/dockerfile.py b/tow/dockerfile.py
index afd1290..7d15b2f 100644
--- a/tow/dockerfile.py
+++ b/tow/dockerfile.py
@@ -60,9 +60,9 @@ class Dockerfile(object):
             # Handle array command
             if command.startswith("[") and command.endswith("]"):
                 command = command[1:-1]
-                return " ".join([sh.strip()[1:-1] for sh in command.split(",")])
+                return [sh.strip()[1:-1] for sh in command.split(",")]
             else:  # It's just shell notation
-                return command.strip()
+                return [command.strip()]
         return None
 
     def envs(self):
diff --git a/tow/templates/tow.sh.tmpl b/tow/templates/tow.sh.tmpl
index 64d612f..9cf076b 100644
--- a/tow/templates/tow.sh.tmpl
+++ b/tow/templates/tow.sh.tmpl
@@ -7,12 +7,4 @@ fi
 
 PATH=$PATH:`pwd`
 
-{% if entrypoint %}
-{% if cmd %}
-"{{entrypoint}}" "{{cmd}}" "$@"
-{% else %}
-"{{entrypoint}}" "$@"
-{% endif %}
-{% else %}
-"{{cmd}}"
-{% endif %}
+{% for cmd in command -%}"{{ cmd }}" {% endfor %}

CMD and ENTRYPOINT arrays should stay arrays in tow.sh
```Dockerfile
ENTRYPOINT ["test"]
CMD ["arg1", "arg2"]
```

should be converted to tow.sh

```bash
"test" "arg1" "arg2" "$@"
```

but not to 

```bash
"test" "arg1 arg2" "$@"
```
diff --git a/tests/dockerfile_tests.py b/tests/dockerfile_tests.py
index 160b5f1..00f563a 100644
--- a/tests/dockerfile_tests.py
+++ b/tests/dockerfile_tests.py
@@ -61,22 +61,22 @@ class DockerfileTest(unittest.TestCase):
     def test_find_entrypoint_or_cmd(self):
         d = Dockerfile("Dockerfile")
         d._Dockerfile__dockerfile = ['FROM ubuntu', 'ENTRYPOINT ["/bin/sh"]', 'CMD ["-c"]']
-        self.assertEqual(d.find_entrypoint_or_cmd(), ("/bin/sh", "-c"))
+        self.assertEqual(d.find_entrypoint_or_cmd(), (["/bin/sh"], ["-c"]))
 
     def test_find_entrypoint_or_cmd_shell_style(self):
         d = Dockerfile("Dockerfile")
         d._Dockerfile__dockerfile = ['FROM ubuntu', 'ENTRYPOINT /bin/sh', 'CMD ["-c"]']
-        self.assertEqual(d.find_entrypoint_or_cmd(), ("/bin/sh", "-c"))
+        self.assertEqual(d.find_entrypoint_or_cmd(), (["/bin/sh"], ["-c"]))
 
     def test_find_entrypoint_or_cmd_cmd_only(self):
         d = Dockerfile("Dockerfile")
         d._Dockerfile__dockerfile = ['FROM ubuntu', 'CMD ["/bin/sh", "-c", "-x"]']
-        self.assertEqual(d.find_entrypoint_or_cmd(), (None, "/bin/sh -c -x"))
+        self.assertEqual(d.find_entrypoint_or_cmd(), (None, ["/bin/sh", "-c", "-x"]))
 
     def test_find_entrypoint_or_cmd_entrypoint_only(self):
         d = Dockerfile("Dockerfile")
         d._Dockerfile__dockerfile = ['FROM ubuntu', 'ENTRYPOINT ["/bin/sh"]']
-        self.assertEqual(d.find_entrypoint_or_cmd(), ("/bin/sh", None))
+        self.assertEqual(d.find_entrypoint_or_cmd(), (["/bin/sh"], None))
 
     def test_find_entrypoint_or_cmd_none(self):
         d = Dockerfile("Dockerfile")

pip install -e .
parse_log_pytest
pytest
pytest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.1.6
MarkupSafe==3.0.2
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
-e git+https://github.com/docker-tow/tow.git@08473f45c43a0f0f6a63e811266c4f1d746ff78a#egg=tow

name: tow
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - jinja2==3.1.6
      - markupsafe==3.0.2
prefix: /opt/conda/envs/tow

tests/dockerfile_tests.py::DockerfileTest::test_find_entrypoint_or_cmd tests/dockerfile_tests.py::DockerfileTest::test_find_entrypoint_or_cmd_cmd_only tests/dockerfile_tests.py::DockerfileTest::test_find_entrypoint_or_cmd_entrypoint_only tests/dockerfile_tests.py::DockerfileTest::test_find_entrypoint_or_cmd_shell_style
tests/dockerfile_tests.py::DockerfileTest::test_add_copy tests/dockerfile_tests.py::DockerfileTest::test_add_copy_after_from tests/dockerfile_tests.py::DockerfileTest::test_add_copy_after_maintainer tests/dockerfile_tests.py::DockerfileTest::test_find_entrypoint_or_cmd_none tests/dockerfile_tests.py::DockerfileTest::test_parse_many_envs tests/dockerfile_tests.py::DockerfileTest::test_parse_multiline tests/dockerfile_tests.py::DockerfileTest::test_parse_spaced_envs
tow/dockerfile.py tow/templates/tow.sh.tmpl tow/commands/build.py
tow/dockerfile.py tow/templates/tow.sh.tmpl tow/commands/build.py