diff --git a/language-docker.cabal b/language-docker.cabal
--- a/language-docker.cabal
+++ b/language-docker.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: 575a027197150763590bb1ff4488b00c9864b6c2abfd2208842c73971ad6ac23
+-- hash: ead90f9d8a8521aaa2655fc03070f462119ea0218d8ab0aa42c04fc065f55856
 
 name:           language-docker
-version:        9.0.1
+version:        9.1.0
 synopsis:       Dockerfile parser, pretty-printer and embedded DSL
 description:    All functions for parsing and pretty-printing Dockerfiles are exported through @Language.Docker@. For more fine-grained operations look for specific modules that implement a certain functionality.
                 See the <https://github.com/hadolint/language-docker GitHub project> for the source-code and examples.
@@ -26,6 +26,8 @@
 build-type:     Simple
 extra-source-files:
     README.md
+    test/fixtures/1.Dockerfile
+    test/fixtures/2.Dockerfile
 
 source-repository head
   type: git
diff --git a/src/Language/Docker/Parser/Run.hs b/src/Language/Docker/Parser/Run.hs
--- a/src/Language/Docker/Parser/Run.hs
+++ b/src/Language/Docker/Parser/Run.hs
@@ -130,10 +130,10 @@
     Right as -> return $ foldr cacheOpts def as
   where
     allowed = Set.fromList ["target", "sharing", "id", "ro", "from", "source", "mode", "uid", "gid"]
-    required = Set.fromList ["target", "sharing"]
+    required = Set.singleton "target"
     cacheOpts :: RunMountArg -> CacheOpts -> CacheOpts
     cacheOpts (MountArgTarget path) co = co {cTarget = path}
-    cacheOpts (MountArgSharing sh) co = co {cSharing = sh}
+    cacheOpts (MountArgSharing sh) co = co {cSharing = Just sh}
     cacheOpts (MountArgId i) co = co {cCacheId = Just i}
     cacheOpts (MountArgReadOnly ro) co = co {cReadOnly = Just ro}
     cacheOpts (MountArgFromImage img) co = co {cFromImage = Just img}
diff --git a/src/Language/Docker/PrettyPrint.hs b/src/Language/Docker/PrettyPrint.hs
--- a/src/Language/Docker/PrettyPrint.hs
+++ b/src/Language/Docker/PrettyPrint.hs
@@ -168,7 +168,7 @@
     CacheMount CacheOpts {..} ->
       "type=cache"
         <> printTarget cTarget
-        <> printSharing cSharing
+        <> maybe mempty printSharing cSharing
         <> maybe mempty printId cCacheId
         <> maybe mempty printFromImage cFromImage
         <> maybe mempty printSource cSource
diff --git a/src/Language/Docker/Syntax.hs b/src/Language/Docker/Syntax.hs
--- a/src/Language/Docker/Syntax.hs
+++ b/src/Language/Docker/Syntax.hs
@@ -222,7 +222,7 @@
 data CacheOpts
   = CacheOpts
       { cTarget :: !TargetPath,
-        cSharing :: !CacheSharing,
+        cSharing :: !(Maybe CacheSharing),
         cCacheId :: !(Maybe Text),
         cReadOnly :: !(Maybe Bool),
         cFromImage :: !(Maybe Text),
@@ -234,7 +234,7 @@
   deriving (Show, Eq, Ord)
 
 instance Default CacheOpts where
-  def = CacheOpts "" Shared Nothing Nothing Nothing Nothing Nothing Nothing Nothing
+  def = CacheOpts "" Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
 
 newtype TmpOpts = TmpOpts {tTarget :: TargetPath} deriving (Eq, Show, Ord)
 
diff --git a/test/Language/Docker/ParserSpec.hs b/test/Language/Docker/ParserSpec.hs
--- a/test/Language/Docker/ParserSpec.hs
+++ b/test/Language/Docker/ParserSpec.hs
@@ -479,16 +479,16 @@
             file
             [ Run $ RunArgs (ArgumentsText "echo foo") flags
             ]
-    it "--mount=type=cache with target and sharing" $
+    it "--mount=type=cache with target" $
       let file =
             Text.unlines
-              [ "RUN --mount=type=cache,target=/foo,sharing=private echo foo",
-                "RUN --mount=type=cache,target=/bar,sharing=shared echo foo",
-                "RUN --mount=type=cache,target=/baz,sharing=locked echo foo"
+              [ "RUN --mount=type=cache,target=/foo echo foo",
+                "RUN --mount=type=cache,target=/bar echo foo",
+                "RUN --mount=type=cache,target=/baz echo foo"
               ]
-          flags1 = def {mount = Just $ CacheMount (def {cTarget = "/foo", cSharing = Private})}
-          flags2 = def {mount = Just $ CacheMount (def {cTarget = "/bar", cSharing = Shared})}
-          flags3 = def {mount = Just $ CacheMount (def {cTarget = "/baz", cSharing = Locked})}
+          flags1 = def {mount = Just $ CacheMount (def {cTarget = "/foo"})}
+          flags2 = def {mount = Just $ CacheMount (def {cTarget = "/bar"})}
+          flags3 = def {mount = Just $ CacheMount (def {cTarget = "/baz"})}
        in assertAst
             file
             [ Run $ RunArgs (ArgumentsText "echo foo") flags1,
@@ -507,7 +507,7 @@
                     CacheMount
                       ( def
                           { cTarget = "/foo",
-                            cSharing = Private,
+                            cSharing = Just Private,
                             cCacheId = Just "a",
                             cReadOnly = Just True,
                             cFromImage = Just "ubuntu",
diff --git a/test/fixtures/1.Dockerfile b/test/fixtures/1.Dockerfile
new file mode 100644
--- /dev/null
+++ b/test/fixtures/1.Dockerfile
@@ -0,0 +1,17 @@
+FROM foo:7-slim
+
+# An extra space after the env value should be no problem
+ENV container=false\
+    container2=true 
+
+ENV A="a.sh" D="c"\
+    B="installDBBinaries.sh" 
+
+ENV X "Y" Z
+
+ENV DOG=Rex\ The\ Dog\ 
+    CAT=Top\ Cat
+
+ENV DOCKER_TLS_CERTDIR=
+ENV foo\ a=afoo' bar 'baz"qu\"z"
+ENV BASE_PATH		/var/spool/apt-mirror
diff --git a/test/fixtures/2.Dockerfile b/test/fixtures/2.Dockerfile
new file mode 100644
--- /dev/null
+++ b/test/fixtures/2.Dockerfile
@@ -0,0 +1,16 @@
+FROM scratch
+
+RUN set -ex; \
+	apt-get update; \
+	if ! which gpg; then \
+		apt-get install -y --no-install-recommends gnupg; \
+	fi; \
+	if ! gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
+# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr
+# so, if we're not running gnupg 1.x, explicitly install dirmngr too
+		apt-get install -y --no-install-recommends dirmngr; \
+	fi; \
+	rm -rf /var/lib/apt/lists/*
+
+ONBUILD ENV RUNNER_CMD_EXEC=${RUNNER_CMD_EXEC:-"java \$JAVA_OPTS -jar /runtime/server.jar \$JAR_OPTS"}
+ENV BUNDLE_WITHOUT=${bundle_without:-'development test'}
