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: ba9067e3ceb04237246263c98a2c1d9e876839f8212ee319e48c05670b47861f
+-- hash: ae482d4758686e114cb8d504d57ff8a1de39b6262598d3823f9b1b195035e9b0
 
 name:           language-docker
-version:        9.1.1
+version:        9.1.2
 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.
diff --git a/src/Language/Docker/Parser.hs b/src/Language/Docker/Parser.hs
--- a/src/Language/Docker/Parser.hs
+++ b/src/Language/Docker/Parser.hs
@@ -20,7 +20,7 @@
 
 contents :: Parser a -> Parser a
 contents p = do
-  void $ takeWhileP Nothing isSpaceNl
+  void $ takeWhileP Nothing (\c -> c == '\r' || c == '\n' || c == ' ' || c == '\t')
   r <- p
   eof
   return r
@@ -34,15 +34,19 @@
     return $ InstructionPos i (T.pack . sourceName $ pos) (unPos . sourceLine $ pos)
 
 parseText :: Text -> Either Error Dockerfile
-parseText = parse (contents dockerfile) "<string>"
+parseText = parse (contents dockerfile) "<string>" . dos2unix
 
 parseFile :: FilePath -> IO (Either Error Dockerfile)
 parseFile file = doParse <$> B.readFile file
   where
-    doParse = parse (contents dockerfile) file . E.decodeUtf8With E.lenientDecode
+    doParse = parse (contents dockerfile) file . dos2unix . E.decodeUtf8With E.lenientDecode
 
 -- | Reads the standard input until the end and parses the contents as a Dockerfile
 parseStdin :: IO (Either Error Dockerfile)
 parseStdin = doParse <$> B.getContents
   where
-    doParse = parse (contents dockerfile) "/dev/stdin" . E.decodeUtf8With E.lenientDecode
+    doParse = parse (contents dockerfile) "/dev/stdin" . dos2unix . E.decodeUtf8With E.lenientDecode
+
+-- | Changes crlf line endings to simple line endings
+dos2unix :: T.Text -> T.Text
+dos2unix = T.replace "\r\n" "\n"
diff --git a/src/Language/Docker/Parser/Copy.hs b/src/Language/Docker/Parser/Copy.hs
--- a/src/Language/Docker/Parser/Copy.hs
+++ b/src/Language/Docker/Parser/Copy.hs
@@ -59,7 +59,7 @@
     _ -> return $ constr (SourcePath <$> fromList (init paths)) (TargetPath $ last paths)
   where
     spaceSeparated =
-      anyUnless (== ' ') `sepEndBy1` (try requiredWhitespace <?> "at least another file path")
+      someUnless "a file" (== ' ') `sepEndBy1` (try requiredWhitespace <?> "at least another file path")
     stringList = brackets $ commaSep stringLiteral
 
 unexpectedFlag :: Text -> Text -> Parser a
diff --git a/test/Language/Docker/IntegrationSpec.hs b/test/Language/Docker/IntegrationSpec.hs
--- a/test/Language/Docker/IntegrationSpec.hs
+++ b/test/Language/Docker/IntegrationSpec.hs
@@ -1,29 +1,43 @@
-{-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE OverloadedLists #-}
+{-# LANGUAGE OverloadedStrings #-}
+
 module Language.Docker.IntegrationSpec where
 
+import qualified Data.Text as Text
+import qualified Data.Text.IO
+import qualified Data.Text.Lazy.IO as L
 import Language.Docker.Parser
-import Language.Docker.Syntax
 import Language.Docker.PrettyPrint (prettyPrint)
-import qualified Data.Text.Lazy.IO as L
-
-
 import Test.HUnit hiding (Label)
 import Test.Hspec
 import Text.Megaparsec hiding (Label)
-import qualified Data.Text as Text
 
 spec :: Spec
 spec = do
-        describe "1" $ do
-            it "no erors" $ do
-               parsed <- parseFile "test/fixtures/1.Dockerfile"
-               case parsed of
-                    Right a -> L.putStr $ prettyPrint a
-                    Left err -> assertFailure $ errorBundlePretty err
-        describe "2" $ do
-            it "no erors" $ do
-               parsed <- parseFile "test/fixtures/2.Dockerfile"
-               case parsed of
-                    Right a -> L.putStr $ prettyPrint a
-                    Left err -> assertFailure $ errorBundlePretty err
+  describe "first" $ do
+    it "no erors" $ do
+      parsed <- parseFile "test/fixtures/1.Dockerfile"
+      case parsed of
+        Right a -> L.putStr $ prettyPrint a
+        Left err -> assertFailure $ errorBundlePretty err
+
+  describe "second" $ do
+    it "no erors" $ do
+      parsed <- parseFile "test/fixtures/2.Dockerfile"
+      case parsed of
+        Right a -> L.putStr $ prettyPrint a
+        Left err -> assertFailure $ errorBundlePretty err
+
+  describe "first clrf" $ do
+    it "no erors" $ do
+      contents <- Data.Text.IO.readFile "test/fixtures/1.Dockerfile"
+      case parseText (Text.replace "\n" "\r\n" contents) of
+        Right _ -> return ()
+        Left err -> assertFailure $ errorBundlePretty err
+
+  describe "second clrf" $ do
+    it "no erors" $ do
+      contents <- Data.Text.IO.readFile "test/fixtures/2.Dockerfile"
+      case parseText (Text.replace "\n" "\r\n" contents) of
+        Right _ -> return ()
+        Left err -> assertFailure $ errorBundlePretty err
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
@@ -214,56 +214,56 @@
       assertAst "CMD true \\\n && true" [Cmd "true  && true"]
     it "quoted command params" $ assertAst "CMD [\"echo\",  \"1\"]" [Cmd ["echo", "1"]]
     it "Parses commas correctly" $ assertAst "CMD [ \"echo\" ,\"-e\" , \"1\"]" [Cmd ["echo", "-e", "1"]]
-  describe "parse SHELL"
-    $ it "quoted shell params"
-    $ assertAst "SHELL [\"/bin/bash\",  \"-c\"]" [Shell ["/bin/bash", "-c"]]
+  describe "parse SHELL" $
+    it "quoted shell params" $
+      assertAst "SHELL [\"/bin/bash\",  \"-c\"]" [Shell ["/bin/bash", "-c"]]
   describe "parse HEALTHCHECK" $ do
     it "parse healthcheck with interval" $
       assertAst
         "HEALTHCHECK --interval=5m \\\nCMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs "curl -f http://localhost/" (Just 300) Nothing Nothing Nothing
+        [ Healthcheck $
+            Check $
+              CheckArgs "curl -f http://localhost/" (Just 300) Nothing Nothing Nothing
         ]
     it "parse healthcheck with retries" $
       assertAst
         "HEALTHCHECK --retries=10 CMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing (Just $ Retries 10)
+        [ Healthcheck $
+            Check $
+              CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing (Just $ Retries 10)
         ]
     it "parse healthcheck with timeout" $
       assertAst
         "HEALTHCHECK --timeout=10s CMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs "curl -f http://localhost/" Nothing (Just 10) Nothing Nothing
+        [ Healthcheck $
+            Check $
+              CheckArgs "curl -f http://localhost/" Nothing (Just 10) Nothing Nothing
         ]
     it "parse healthcheck with start-period" $
       assertAst
         "HEALTHCHECK --start-period=2m CMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs "curl -f http://localhost/" Nothing Nothing (Just 120) Nothing
+        [ Healthcheck $
+            Check $
+              CheckArgs "curl -f http://localhost/" Nothing Nothing (Just 120) Nothing
         ]
     it "parse healthcheck with all flags" $
       assertAst
         "HEALTHCHECK --start-period=2s --timeout=1m --retries=3 --interval=5s    CMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs
-              "curl -f http://localhost/"
-              (Just 5)
-              (Just 60)
-              (Just 2)
-              (Just $ Retries 3)
+        [ Healthcheck $
+            Check $
+              CheckArgs
+                "curl -f http://localhost/"
+                (Just 5)
+                (Just 60)
+                (Just 2)
+                (Just $ Retries 3)
         ]
     it "parse healthcheck with no flags" $
       assertAst
         "HEALTHCHECK CMD curl -f http://localhost/"
-        [ Healthcheck
-            $ Check
-            $ CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing Nothing
+        [ Healthcheck $
+            Check $
+              CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing Nothing
         ]
   describe "parse MAINTAINER" $ do
     it "maintainer of untagged scratch image" $
@@ -456,6 +456,12 @@
        in assertAst
             file
             [ Copy $ CopyArgs (fmap SourcePath ["C:\\\\go"]) (TargetPath "C:\\\\go") NoChown NoSource
+            ]
+    it "does not get confused with trailing whitespace" $
+      let file = Text.unlines ["COPY a b  "]
+       in assertAst
+            file
+            [ Copy $ CopyArgs [SourcePath "a"] (TargetPath "b") NoChown NoSource
             ]
   describe "RUN with experimental flags" $ do
     it "--mount=type=bind and target" $
